Submission #859458

#TimeUsernameProblemLanguageResultExecution timeMemory
859458thinknoexitPrisoner Challenge (IOI22_prison)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; using ll = long long; vector<vector<int>> devise_strategy(int n) { vector<vector<int>> ans(37, vector<int>(n + 1)); ans[0][0] = 1; for (int i = 1;i <= n;i++) { ans[0][i] = 36; } for (int i = 1;i <= 12;i++) { int a = i; ans[i][0] = 2; for (int j = 1;j <= n;j++) { if (!(j & (1 << (a - 1)))) ans[i][j] = -2; else ans[i][j] = 24 + a - 1; } } for (int i = 13;i <= 24;i++) { int a = i - 12; ans[i][0] = 2; for (int j = 1;j <= n;j++) { if (j & (1 << (a - 1))) ans[i][j] = -1; else ans[i][j] = 24 + a - 1; } } for (int i = 25;i <= 36;i++) { int a = i - 24; ans[i][0] = 1; for (int j = 1;j <= n;j++) { if (j & (1 << (a - 1))) ans[i][j] = a; else ans[i][j] = 12 + a; } } return ans; } int main() { int n, a, b; cin >> n >> a >> b; vector<vector<int>> adj = devise_strategy(n); int now = 0; int cnt = 0; while (now >= 0 && cnt <= 500) { cout << now << '\n'; if (adj[now][0] == 1) { now = adj[now][a]; } else { now = adj[now][b]; } cnt++; } cout << cnt << ' ' << now; } /* // a (1 <= a <= 12) // - 0 -> start point (check A) go to leftmost bit 36 // - a (check B) if(B don't have ath bit) Answer B // else write 24 + a - 1 // - 12 + a (check B) if(B have ath bit) Answer A // else write 24 + a - 1 // - 24 + a (check A) if(A have ath bit) write a-1 // else write 12 + a - 1 */

Compilation message (stderr)

/usr/bin/ld: /tmp/ccJdQb91.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccKKhxm3.o:prison.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status