Submission #986526

# Submission time Handle Problem Language Result Execution time Memory
986526 2024-05-20T17:52:33 Z Hugo1729 Prisoner Challenge (IOI22_prison) C++17
38 / 100
15 ms 1628 KB
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> devise_strategy(int N) {
    int x=3*13-1;
    vector<vector<int>> ans(x+1,vector<int>(N+1,0));

    for(int i=0;i<=x;i++)ans[i][0]=((i%3)!=0);

    for(int i=0;i<x-1;i++){
        for(int j=1;j<N+1;j++){
            int p = i/3;
            int b = 12-p;
            if(i%3==0){
                if(j&(1<<b))ans[i][j]=i+1;
                else ans[i][j]=i+2;
            }else if(i%3==1){
                if(j&(1<<b))ans[i][j]=i+2;
                else ans[i][j]=-2;
            }else{
                if(j&(1<<b))ans[i][j]=-1;
                else ans[i][j]=i+1;
            }
        }
    }

    for(int j=1;j<N+1;j++){
        if(j&1)ans[x-1][j]=0;
        else ans[x-1][j]=-2;

        if(j&1)ans[x][j]=-1;
        else ans[x][j]=0;
    }

    

    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 500 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Partially correct 1 ms 348 KB Output is partially correct
3 Partially correct 0 ms 348 KB Output is partially correct
4 Partially correct 7 ms 860 KB Output is partially correct
5 Partially correct 12 ms 1372 KB Output is partially correct
6 Partially correct 15 ms 1628 KB Output is partially correct
7 Partially correct 15 ms 1624 KB Output is partially correct
8 Partially correct 0 ms 348 KB Output is partially correct
9 Partially correct 1 ms 348 KB Output is partially correct
10 Partially correct 2 ms 604 KB Output is partially correct
11 Partially correct 6 ms 876 KB Output is partially correct
12 Partially correct 13 ms 1372 KB Output is partially correct