Submission #830294

#TimeUsernameProblemLanguageResultExecution timeMemory
8302947modyPrisoner Challenge (IOI22_prison)C++17
Compilation error
0 ms0 KiB
// #include "prison.h" #include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> ans(26,vector<int>(N+1)); for(int i=1;i<=N;i++){ int curr=1; curr+=(i>>12)&1; ans[0][i]=curr; } int move=12; for(int i=1; i <=25;i++){ int curr=((i+1)/2)%2; ans[i][0]=curr; curr=((i+1)/2)*2 + 1; for(int j=1; j<=N;j++){ if(i%2){ if((j>>move)&1){ ans[i][j]=-(1+ans[i][0]); } else{ if(move==0){ if(j&1){ ans[i][j]=-2; } else{ ans[i][j]=-1; } } else{ curr+=(j>>(move-1))&1; ans[i][j]=curr; } } } else{ if((j>>move)&1 == 0){ ans[i][j]=-(1+ans[i][0]); } else{ if(move==0){ if(j&1){ ans[i][j]=-2; } else{ ans[i][j]=-1; } } else{ curr+=(j>>(move-1))&1; ans[i][j]=curr; } } } } if(i%2==0) move--; } return ans; } void solve(){ int n; cin >> n; vector<vector<int>> arr=devise_strategy(n); for(auto c : arr){ for(auto i : c) cout << i << ' '; cout << endl; } } int main(){ ios::sync_with_stdio(false);cout.tie();cin.tie(); int t=1; // cin >> t; while(t--){ solve(); } }

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:35:32: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   35 |                 if((j>>move)&1 == 0){
      |                              ~~^~~~
/usr/bin/ld: /tmp/ccR7eWy0.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc46fDhY.o:prison.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status