제출 #1077235

#제출 시각아이디문제언어결과실행 시간메모리
1077235pcc죄수들의 도전 (IOI22_prison)C++17
36.50 / 100
447 ms3536 KiB
#include "prison.h" #include <vector> #include <bits/stdc++.h> using namespace std; std::vector<std::vector<int>> devise_strategy(int N) { int ans = 13*2*2;//nowbit,turn,bit of a vector<vector<int>> re(ans,vector<int>(N+1,-1)); vector<int> all; for(int i = 0;i<ans;i++){ int turn = ((i>>1)&1); int tar = 12-(i>>2); int bit = i&1; if(turn == 0)re[i][0] = 0; else re[i][0] = 1; for(int j = 1;j<=N;j++){ if(turn == 0){ re[i][j] = (i/4*4)|2|((j>>tar)&1); } else{ if(bit != ((j>>tar)&1)){ if((j>>tar)&1)re[i][j] = -1; else re[i][j] = -2; } else{ re[i][j] = ((i/4+1)*4); if(re[i][j]>=ans)re[i][j] = -1; } } } } for(auto &i:re)for(auto &j:i)if(j>=0)all.push_back(j); all.push_back(0); sort(all.begin(),all.end());all.resize(unique(all.begin(),all.end())-all.begin());cerr<<"ALL: "<<all.size()<<endl; ans = all.size(); vector<vector<int>> v(ans,vector<int>(N+1,-1)); for(int i = 0;i<ans;i++){ int p = all[i]; v[i][0] = re[p][0]; for(int j = 1;j<=N;j++){ if(re[p][j]<0)v[i][j] = re[p][j]; else v[i][j] = lower_bound(all.begin(),all.end(),re[p][j])-all.begin(); } } for(int i = 0;i<ans;i++){ cerr<<i<<":";for(auto &j:v[i])cerr<<j<<',';cerr<<endl; } cerr<<"INIT DONE!"<<endl; return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...