제출 #625810

#제출 시각아이디문제언어결과실행 시간메모리
625810ETK죄수들의 도전 (IOI22_prison)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "prison.h" #define rep(i,a,b) for(int i=(a);i<=(b);++i) #define per(i,a,b) for(int i=(a);i>=(b);--i) #define pii pair<int,int> #define vi vector<int> #define fi first #define se second #define pb push_back #define ALL(x) x.begin(),x.end() #define sz(x) int(x.size()) #define ll long long using namespace std; vector <vi> ans; /* when we go into node p,the previous number was in the range [L,R], and (dep,id) represents the next node that we will travel to if our number is in [l,r]. Thus for [L,l],[r,R] we can already decide the answer, otherwise we need to keep moving. */ int n; void work(int p,int dep,int id,int L,int R,int l,int r){ int u = 3 * dep + id; while(sz(ans) < u){ ans.pb(vi(n + 1,0)); if((sz(ans) + 1) % 6 < 2)ans[i][0] = 1; } rep(i,l,r)ans[p][i] = u; rep(i,L,l)ans[u][i] = -1 - ans[u][0]; rep(i,r,R)ans[u][i] = -2 + ans[u][0]; l++,r--; if(r - l < 0)return; if(r - l < 2){ work(u,dep + 1,1,l - 1,r + 1,l,r); return; } if(r - l < 4){ work(u,dep + 1,1,l - 1,r + 1,l,(l + r) / 2); work(u,dep + 1,2,l - 1,r + 1,(l + r) / 2 + 1,r); return; } int m1 = (l + l + r) / 3,m2 = (l + r + r) / 3; l--,r++; work(u,dep + 1,1,l,r,l,m1); work(u,dep + 1,2,l,r,m1 + 1,m2); work(u,dep + 1,3,l,r,m2 + 1,r); } vector <vi> devise_strategy(int N){ n = N; work(0,-1,3,1,n,1,n); return ans; }

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

prison.cpp: In function 'void work(int, int, int, int, int, int, int)':
prison.cpp:25:38: error: 'i' was not declared in this scope
   25 |         if((sz(ans) + 1) % 6 < 2)ans[i][0] = 1;
      |                                      ^