Submission #41558

#TimeUsernameProblemLanguageResultExecution timeMemory
41558farmersriceQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
100 / 100
1598 ms170688 KiB
#include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC target ("sse4") //#pragma GCC target ("avx,tune=native") //Use above if bruteforcing with lots of small operations. Or just use it anytime, there's no downside. AVX is better slightly /* TASK: hidden LANG: C++11 */ using namespace std; typedef long long ll; typedef pair<int, int> pair2; typedef pair<int, pair<int, int> > pair3; typedef pair<int, pair<int, pair<int, int> > > pair4; #define MAXN 950 #define INF 1000000000000000000LL #define mp make_pair #define add push_back #define remove pop int subset[MAXN]; bool generated; void generateSubsets() { int gc = 1; for (int i = 0; i < (1 << 12); i++) { int counter = 0; for (int j = 0; j < 12; j++) { if ((i & (1 << j))) counter++; } if (counter == 6) { subset[gc++] = i; } } } int encode(int n, int x, int y) { if (!generated) { generated = true; generateSubsets(); } for (int i = 0; i < 12; i++) { if ((subset[x] & (1 << i)) && !(subset[y] & (1 << i))) return i + 1; } }
#include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC target ("sse4") //#pragma GCC target ("avx,tune=native") //Use above if bruteforcing with lots of small operations. Or just use it anytime, there's no downside. AVX is better slightly /* TASK: hidden LANG: C++11 */ using namespace std; typedef long long ll; typedef pair<int, int> pair2; typedef pair<int, pair<int, int> > pair3; typedef pair<int, pair<int, pair<int, int> > > pair4; #define MAXN 200013 #define INF 1000000000000000000LL #define mp make_pair #define add push_back #define remove pop int subset[MAXN]; bool generated; void generateSubsets() { int gc = 1; for (int i = 0; i < (1 << 12); i++) { int counter = 0; for (int j = 0; j < 12; j++) { if ((i & (1 << j))) counter++; } if (counter == 6) { subset[gc++] = i; } } } int decode(int n, int q, int h) { if (!generated) { generated = true; generateSubsets(); } h--; for (int i = 0; i < 12; i++) { if (subset[q] & (1 << h)) { return 1; } else { return 0; } } }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...