Submission #664554

#TimeUsernameProblemLanguageResultExecution timeMemory
664554blueAncient Machine (JOI21_ancient_machine)C++17
Compilation error
0 ms0 KiB
#include "Anna.h" #include <bits/stdc++.h> namespace { using namespace std; using vi = vector<int>; using pii = pair<int, int>; using vpii = vector<pii>; using ll = long long; using vll = vector<ll>; #define sz(x) int(x.size()) const int obs = 2; const int cbs = 2; vi encode(vi A) { while(sz(A) % obs != 0) A.push_back(0); cerr << "to encode: "; for(int u = 0; u < sz(A); u++) cerr << A[u]; cerr << '\n'; ll pow2[cbs]; pow2[0] = 1; for(int i = 1; i < cbs; i++) pow2[i] = pow2[i-1] * 2LL; ll dp[1 + obs][2]; dp[1][0] = 1; dp[1][1] = 1; for(int i = 2; i <= obs; i++) { dp[i][0] = dp[i-1][0] + dp[i-1][1]; dp[i][1] = dp[i-1][0]; } // cerr << "dp values: \n"; // for(int i = 1; i <= obs; i++) // cerr << dp[i][0] << ' ' << dp[i][1] << '\n'; vi res; for(int i = 0; i < sz(A); i += obs) { // cerr << "i = " << i << '\n'; vi a; ll val = 0; for(int j = i; j < i + obs; j++) { a.push_back(A[j]); } for(int j = 0; j < obs; j++) { if(a[j] == 1) { val += dp[obs - j][0]; // cerr << "add dp 0 " << obs - j << " : " << dp[obs - j][0] << '\n'; j++; } } for(int h : a) { cerr << h; } cerr << " -> "; cerr << "sending val = " << val << '\n'; for(int j = 0; j < cbs; j++) res.push_back(bool(val & pow2[j])); } cerr << "res = "; for(int y : res) cerr << y; cerr << '\n'; return res; } } void Anna(int N, vector<char> S) { // cerr << "hello\n"; int fx = 0; int lz = N-1; while(fx < N && S[fx] != 'X') fx++; while(lz >= 0 && S[lz] != 'Z') lz--; if(fx == N || lz == -1 || fx >= lz) { // cerr << "hello2\n"; return; } vi tosend(N+1, 0); tosend[fx] = 1; tosend[lz+1] = 1; for(int i = fx+2; i <= lz-1; i++) { if(S[i-1] == 'Z' && S[i] == 'Y') tosend[i] = 1; } for(int i = 0; i+1 < sz(tosend); i++) assert(!(tosend[i] == 1 && tosend[i+1] == 1)); // for(int i = 0; i <= N; i++) // cerr << tosend[i]; // cerr << '\n'; tosend = encode(tosend); for(int f : tosend) Send(f); }

Compilation message (stderr)

/usr/bin/ld: /tmp/cccURPoj.o: in function `main':
grader_bruno.cpp:(.text.startup+0x24d): undefined reference to `Bruno(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status