Submission #643589

#TimeUsernameProblemLanguageResultExecution timeMemory
643589keta_tsimakuridzePrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
#include <vector>

std::vector<std::vector<int>> devise_strategy(int N) {


  vector<vector<int>> v;
  v.resize(3 * 8, vector<int> (N + 1));
  int x = 2187, t = 1;
  for(int i = 1; i <= N; i++) {
    v[0][i] = i / x + 1;
  }
  for(int i = 1; i <= 24; i += 3) {
    // i , i + 1, i + 3 --- eseni aris
    for(int T = 0; T < 3; T++) {
        if(i + T == 24) continue;v[i + T][0] = t;
        for(int j = 1; j <= N; j++) {
            if((j % (x * 3)) / x != T) {
                v[i + T][j] = ((j % (x * 3)) / x < T ? -t - 1 : -(1 - t) - 1);
            } else {
                if(x > 3 || (x == 3 && j % 3 != 2))
                v[i + T][j] = i + 3 + ((j % x) / (x / 3));
                else if(x == 3 && j % 3 != 2) v[i + T][j] = -(1 - t) - 1;
            }
        }
    }

    x /= 3; t ^= 1;
  }
  return v;

}

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:18:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   18 |         if(i + T == 24) continue;v[i + T][0] = t;
      |         ^~
prison.cpp:18:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   18 |         if(i + T == 24) continue;v[i + T][0] = t;
      |                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...