Submission #915481

#TimeUsernameProblemLanguageResultExecution timeMemory
915481NamkhingPrisoner Challenge (IOI22_prison)C++17
10 / 100
3 ms1112 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; vvi devise_strategy(int N) { int divisor = sqrt(N); vvi report(N / divisor + divisor + 2, vi(N + 1)); report[0][0] = 0; for (int i = 1; i <= N; i++) { report[0][i] = i / divisor + 1; } for (int i = 1; i <= N / divisor + 1; i++) { for (int j = 1; j <= N; j++) { int total = j / divisor + 1; if (i == total) { report[i][j] = N / divisor + j % divisor + 2; } else { report[i][j] = i < total ? -1 : -2; } } report[i][0] = 1; } for (int i = N / divisor + 2; i <= N / divisor + divisor + 1; i++) { for (int j = 1; j <= N; j++) { int total = N / divisor + j % divisor + 2; report[i][j] = total < i ? -1 : -2; } report[i][0] = 0; } return report; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...