Submission #1164175

#TimeUsernameProblemLanguageResultExecution timeMemory
1164175SmuggingSpunPrisoner Challenge (IOI22_prison)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "prison.h"
using namespace std;
vector<vector<int>>devise_strategy(int n){
    vector<vector<int>>s(40, vector<int>(n + 1));
    fill(s[s[0][0] = 0].begin() + 1, s[0].end(), 13);
    for(int i = 1; i < 14; i++){
        s[i][0] = 0;
        for(int j = 1; j <= n; i++){
            if(1 << (i - 1) & j){
                s[i][j] = i + 26;
            }
            else{
                s[i][j] = i + 13;
            }
        }
    }
    for(int i = 14; i < 27; i++)[
        s[i][0] = 1;
        for(int j = 1; j <= n; j++){
            if(1 << (i - 14) & j){
                s[i][j] = -1;
            }
            else{
                s[i][j] = i - 14;
            }
        }
    ]
    for(int i = 27; i < 40; i++){
        s[i][0] = 1;
        for(int j = 1; j <= n; j++){
            if(1 << (i - 27) & j){
                s[i][j] = i - 27;
            }
            else{
                s[i][j] = -2;
            }
        }
    }
    return s;
}   

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:19:10: error: expected ',' before '[' token
   19 |         s[i][0] = 1;
      |          ^
      |          ,
prison.cpp:19:10: error: expected identifier before '[' token
prison.cpp:19:20: error: expected ']' before ';' token
   19 |         s[i][0] = 1;
      |                    ^
      |                    ]
prison.cpp: In lambda function:
prison.cpp:19:20: error: expected '{' before ';' token
prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:21:22: error: 'i' was not declared in this scope
   21 |             if(1 << (i - 14) & j){
      |                      ^
prison.cpp:28:5: error: expected primary-expression before ']' token
   28 |     ]
      |     ^
prison.cpp:29:21: error: 'i' was not declared in this scope
   29 |     for(int i = 27; i < 40; i++){
      |                     ^