답안 #836124

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
836124 2023-08-24T07:40:04 Z tengiz05 죄수들의 도전 (IOI22_prison) C++17
30 / 100
23 ms 2004 KB
#include "prison.h"

#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> devise_strategy(int n) {
    vector<vector<int>> f(13 * 4, vector<int>(n + 1));
    for (int i = 0; i < 13 * 4; i++) {
        int num = 12 - (i >> 2);
        int A = i & 1;
        int res = i >> 1 & 1;
        if (A == 0) {
            f[i][0] = 0;
            for (int j = 1; j <= n; j++) {
                int bit = j >> num & 1;
                f[i][j] = ((12 - num) << 2) | (bit << 1) | 1;
            }
        }
        if (A == 1) {
            f[i][0] = 1;
            for (int j = 1; j <= n; j++) {
                int bit = j >> num & 1;
                if (bit == res) {
                    f[i][j] = (12 - num + 1) << 2;
                } else {
                    if (res < bit) {
                        f[i][j] = -1;
                    } else {
                        f[i][j] = -2;
                    }
                }
            }
        }
    }
    for (int i = 0; i < f.size(); i++) {
        for (int j = 0; j <= n; j++) {
            if (f[i][j] >= 13 * 4) f[i][j] = 0;
            // cout << f[i][j] << " \n"[j == n];
        }
    }
    return f;
}

Compilation message

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int i = 0; i < f.size(); i++) {
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 4 ms 468 KB Output is correct
6 Correct 3 ms 400 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Partially correct 0 ms 212 KB Output is partially correct
3 Partially correct 0 ms 212 KB Output is partially correct
4 Partially correct 9 ms 980 KB Output is partially correct
5 Partially correct 18 ms 1748 KB Output is partially correct
6 Partially correct 23 ms 1996 KB Output is partially correct
7 Partially correct 20 ms 2004 KB Output is partially correct
8 Partially correct 1 ms 212 KB Output is partially correct
9 Partially correct 2 ms 340 KB Output is partially correct
10 Partially correct 3 ms 468 KB Output is partially correct
11 Partially correct 8 ms 980 KB Output is partially correct
12 Partially correct 17 ms 1620 KB Output is partially correct