Codeforces 742B Arpa ' s obvious problem and Mehrdad ' s terrible solution (brute force enumeration)

Source: Internet
Author: User

Test instructions: The number of n is determined, and the number of logarithms is satisfied, Ai^bi = x.

Analysis: Brute force enumeration on the line, the complexity of N.

The code is as follows:

#pragma COMMENT (linker, "/stack:1024000000,1024000000") #include <cstdio> #include <string> #include < cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include < queue> #include <algorithm> #include <vector> #include <map> #include <cctype> #include < cmath> #include <stack> #define FREOPENR freopen ("In.txt", "R", stdin) #define FREOPENW freopen ("OUT.txt", "W",  STDOUT) using namespace Std;typedef long Long ll;typedef pair<int, int> p;const int inf = 0x3f3f3f3f;const double inf = 0x3f3f3f3f3f3f;const Double PI = ACOs ( -1.0); const double EPS = 1e-8;const int maxn = 1e5 + 5;const int mod = 1e9 + 7;co NST int dr[] = {-1, 1, 0, 0};const int dc[] = {0, 0, 1, -1};const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0 101 "," 0110 "," 0111 "," $ "," 1001 "," 1010 "," 1011 "," 1100 "," 1101 "," 1110 "," 1111 "};int N, m;const int mon[] = {0, 31, 2 8, A, a, a, a, a, a, a, a, 31};const inT monn[] = {0, h, h, N, N, H,, H, H, N, h, 31};inline int Min (int a, int b) {return a < b? A:b;} inline int Max (int a, int b) {return a > b a:b;} inline ll Min (ll A, ll b) {return a < b a:b;} inline ll Max (ll A, ll b) {return a > b a:b;} inline bool Is_in (int r, int c) {return R >= 0 && r < n && C >= 0 && C < m;}    int A[100005];int B[100005];int Main () {LL n, m;        while (scanf ("%i64d%i64d", &n, &m) = = 2) {for (int i = 0; i < n; ++i) scanf ("%d", a+i);        memset (b, 0, sizeof B); LL ans = 0;//if (m = = 0) {//for ()//continue;//} for (int i = n-1; I >= 0;-            -i) {LL t = a[i] ^ m;            if (T < 100005) ans + = b[t];        ++b[a[i]];    } cout << ans << endl; } return 0;}

Codeforces 742B Arpa ' s obvious problem and Mehrdad ' s terrible solution (brute force enumeration)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.