Submission #915481

# Submission time Handle Problem Language Result Execution time Memory
915481 2024-01-24T03:17:13 Z Namkhing Prisoner Challenge (IOI22_prison) C++17
10 / 100
3 ms 1112 KB
#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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 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 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 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 464 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 1 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 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 2 ms 1112 KB Wrong answer detected in grader
5 Halted 0 ms 0 KB -