제출 #1055995

#제출 시각아이디문제언어결과실행 시간메모리
1055995tolbi죄수들의 도전 (IOI22_prison)C++17
65 / 100
7 ms1116 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; #define tol(bi) (1ll<<((int)(bi))) constexpr int LOG = 13; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> ret(LOG*2-1,vector<int>(N+1)); int ind = -1; for (int i = 0; i < LOG*2; i++){ if (i==1) continue; ind++; int curbit = i>>1; int bionceki = i&1; int oncekibit = (LOG-1)-curbit+1; int bubit = (LOG-1)-curbit; for (int j = 1; j <= N; j++){ if ((curbit&1)==0){ ret[ind][0]=0; if (!!(j&tol(oncekibit)) != bionceki){ if (bionceki) ret[ind][j]=-1; else ret[ind][j]=-2; } else { if (bubit==0) ret[ind][j]=(j&tol(bubit))?-2:-1; else ret[ind][j]=curbit*2+2+(!!(j&tol(bubit))); } } else { ret[ind][0]=1; if (!!(j&tol(oncekibit)) != bionceki){ if (bionceki) ret[ind][j]=-2; else ret[ind][j]=-1; } else { if (bubit==0) ret[ind][j]=(j&tol(bubit))?-1:-2; else ret[ind][j]=curbit*2+2+(!!(j&tol(bubit))); } } } } for (int i = 0; i < ret.size(); i++){ for (int j = 1; j < ret[i].size(); j++){ if (ret[i][j]>=1) ret[i][j]--; } } return ret; }

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

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:42:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  for (int i = 0; i < ret.size(); i++){
      |                  ~~^~~~~~~~~~~~
prison.cpp:43:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |   for (int j = 1; j < ret[i].size(); j++){
      |                   ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...