Submission #1081543

#TimeUsernameProblemLanguageResultExecution timeMemory
1081543faricaPrisoner Challenge (IOI22_prison)C++17
Compilation error
0 ms0 KiB
#include "prison.h"

#include <bits/stdc++.h>

using namespace std;

std::vector<std::vector<int>> devise_strategy(int N) {
    vector<vector<int>>s(25, vector<int>(N+1, 0));
    s[0][0] = i%2;
    for(int j=1; j<=N; ++j) {
        if((1LL<<12)&j) s[0][j] = 24;
        else s[0][j] = 12;
    }
    for(int i=1; i<25; ++i) {
        s[i][0] = i%2;
        for(int j=1; j<=N; ++j) {
            if(i > 12) {
                int bit = i - 12;
                if((1LL<<bit) & j) {
                    --bit;
                    if(!bit) {
                        if(j%2) s[i][j] = -(i%2);
                        else s[i][j] = -((i+1)%2);
                    } else {
                        if((1LL<<bit) & j) s[i][j] = bit + 12;
                        else s[i][j] = bit;
                    }
                } else s[i][j] = -((i+1)%2);
            } else {
                if((1LL<<i) & j) s[i][j] = -(i%2);
                else {
                    int bit = i - 1;
                    if(!bit) {
                        if(j%2) s[i][j] = -(i%2);
                        else s[i][j] = -((i+1)%2);
                    } else {
                        if((1LL<<bit) & j) s[i][j] = bit + 12;
                        else s[i][j] = bit;
                    }
                }
            }
        }
    }

    return s;
}

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:9:15: error: 'i' was not declared in this scope
    9 |     s[0][0] = i%2;
      |               ^