제출 #628645

#제출 시각아이디문제언어결과실행 시간메모리
628645abdzag죄수들의 도전 (IOI22_prison)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "prison.h" using namespace std; std::vector<std::vector<int>> devise_strategy(int N) { int n=N; vector<vector<int>> ans(N+1); ans[0][0]=1; for(int i=1;i<=n;i++){ int next_index=12; ans[0][i]=next_index*2+(((1<<next_index)&i)?1:2); } for(int i=1;i<=30;i++){ int current_index=i/2; ans[i][0]=current_index%2; for(int j=1;j<=n;j++){ if(j&(1<<current_index)<(i-1)%2){ if(ans[i][0])ans[i][j]=-1; else ans[i][j]=-2; } else if(j&(1<<current_index)>(i-1)%2){ if(ans[i][0])ans[i][j]=-2; else ans[i][j]=-1; } else { int next_index=current_index-1; ans[i][j]=next_index*2+(((1<<next_index)&i)?1:2); } } } return ans; } int main(){ return 0; }

컴파일 시 표준 에러 (stderr) 메시지

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:18:36: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   18 |             if(j&(1<<current_index)<(i-1)%2){
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~
prison.cpp:22:41: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   22 |             else if(j&(1<<current_index)>(i-1)%2){
      |                       ~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/bin/ld: /tmp/cc9pU2v2.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cctYKKD0.o:prison.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status