제출 #1068150

#제출 시각아이디문제언어결과실행 시간메모리
1068150Unforgettablepl죄수들의 도전 (IOI22_prison)C++17
65 / 100
9 ms1116 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> ans; { vector<int> curr(N+1); curr[0]=1; for(int i=1;i<=N;i++) { if(i&(1<<12))curr[i]=2; else curr[i]=1; } ans.emplace_back(curr); } int move = 1; for(int bit=12;bit;bit--) { vector<int> curr(N+1); // If 0 at bit curr[0]=move-1; for(int i=1;i<=N;i++) { if(i&(1<<bit))curr[i]=-(move^3); else if(i&(1<<(bit-1)))curr[i]=ans.size()+3; else curr[i]=ans.size()+2; } ans.emplace_back(curr); // If 1 at bit curr[0]=move-1; for(int i=1;i<=N;i++) { if((i&(1<<bit))==0)curr[i]=-(move); else if(i&(1<<(bit-1)))curr[i]=ans.size()+2; else curr[i]=ans.size()+1; } ans.emplace_back(curr); move^=3; } move^=3; for(int&i:ans[ans.size()-1]) { if(i==ans.size())i=-move; else if(i==ans.size()+1)i=-(move^3); } for(int&i:ans[ans.size()-2]) { if(i==ans.size())i=-move; else if(i==ans.size()+1)i=-(move^3); } return ans; }

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

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:39:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         if(i==ans.size())i=-move;
      |            ~^~~~~~~~~~~~
prison.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         else if(i==ans.size()+1)i=-(move^3);
      |                 ~^~~~~~~~~~~~~~
prison.cpp:43:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         if(i==ans.size())i=-move;
      |            ~^~~~~~~~~~~~
prison.cpp:44:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         else if(i==ans.size()+1)i=-(move^3);
      |                 ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...