Submission #564458

#TimeUsernameProblemLanguageResultExecution timeMemory
564458MajidQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; //Types using ll = long long; using db = double; //Vectors #define pb push_back #define sz(vec) ((ll)vec.size()) #define all(vec) vec.begin(), vec.end() //things #define f first #define s second const int SMALLINF = 1e9 + 7; const ll BIGINF = ((ll)1e18) + 7; #define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL); ll encode(ll n, ll x, ll y){ string ans; ll mx = 0, cnt = 0; while(x){ ans = (char)(x%2+'0') + ans; x/=2; } for(ll i = 0; i < sz(ans); i++){ mx = max(mx, cnt); if(ans[i]=='1')cnt++; else{ mx = max(mx, cnt); cnt = 0; } } mx = max(mx, cnt); return __builtin_popcount(x) + mx; }
#include<bits/stdc++.h> using namespace std; //Types using ll = long long; using db = double; //Vectors #define pb push_back #define sz(vec) ((ll)vec.size()) #define all(vec) vec.begin(), vec.end() //things #define f first #define s second const int SMALLINF = 1e9 + 7; const ll BIGINF = ((ll)1e18) + 7; #define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL); ll decode(ll n, ll q, ll h){ string ans; ll mx = 0, cnt = 0; while(q){ ans = (char)(q%2+'0') + ans; q/=2; } for(ll i = 0; i < sz(ans); i++){ mx = max(mx, cnt); if(ans[i]=='1')cnt++; else{ mx = max(mx, cnt); cnt = 0; } } return (__builtin_popcount(x) + mx == h); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccVRSgbV.o: in function `main':
grader_encode.c:(.text.startup+0x129): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status

decoder.cpp: In function 'll decode(ll, ll, ll)':
decoder.cpp:42:32: error: 'x' was not declared in this scope; did you mean 'mx'?
   42 |     return (__builtin_popcount(x) + mx == h);
      |                                ^
      |                                mx