| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 627253 | haojiandan | 죄수들의 도전 (IOI22_prison) | C++17 | 6 ms | 672 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
int bel[5010];
vector<vector<int>> devise_strategy(int n) {
	vector<vector<int> > res(22,vector<int>(n+1));
	for (int I=0;I<7;I++) {
		int L=I*3,R=L+2;
		for (int i=L;i<=R;i++) res[i][0]=I&1;
		int A=-1,B=-2; if (I&1) swap(A,B);
		for (int i=L;i<=R;i++) {
			int l=-1,r=-1;
			for (int j=1;j<=n;j++) {
				if (bel[j]<i) res[i][j]=A;
				else if (bel[j]>i) res[i][j]=B;
				else {
					if (l==-1) l=j; r=j;
				}
			}
			if (l!=-1) {
				res[i][l]=A,res[i][r]=B;
				int p=R,len=(r-1-l+2)/3;
				for (int k=l+1;k<r;k++) {
					if ((k-l-1)%len==0) p++;
					res[i][k]=min(p,21);
				}
			}
		}
		for (int i=1;i<=n;i++) if (bel[i]>=L&&bel[i]<=R) { bel[i]=res[bel[i]][i]; if (bel[i]==B) bel[i]=1e9; }
	}
	return res;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
