답안 #300615

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
300615 2020-09-17T10:27:52 Z CodePlatina 식물 비교 (IOI20_plants) C++14
11 / 100
4000 ms 46472 KB
#include "plants.h"
#include <iostream>

using namespace std;

int N, K;
bool arr[5050][5050];

void init(int k, vector<int> r)
{
	N = r.size(); K = k;
	for(int i = 0; i < N; ++i)
    {
        int cnt = 0, tar = -1;
        for(int j = 0; j < K - 1; ++j) if(r[j] == 0) ++cnt;
        for(int j = K - 1; j < N; ++j)
        {
            if(cnt == 0 && r[j] == 0) { tar = j; break; }
            if(r[j] == 0) ++cnt;
            if(r[j - K + 1] == 0) --cnt;
        }
        if(tar == -1) for(int j = 0; j < K - 1; ++j)
        {
            if(cnt == 0 && r[j] == 0) { tar = j; break; }
            if(r[j] == 0) ++cnt;
            if(r[N + j - K + 1] == 0) --cnt;
        }

        r[tar] = -1;
        for(int j = 1; j < K; ++j)
        {
            int t = tar + j; if(t >= N) t -= N;
            if(r[t] != -1) arr[tar][t] = true;

            t = tar - j; if(t < 0) t += N;
            if(r[t] != -1) --r[t], arr[tar][t] = true;
        }
    }

    for(int i = 0; i < N; ++i)
    {
        for(int j = 0; j < N; ++j)
        {
            for(int k = 0; k < N; ++k)
            {
                if(arr[j][i] && arr[i][k]) arr[j][k] = true;
            }
        }
    }

//    for(int i = 0; i < N; ++i)
//    {
//        for(int j = 0; j < N; ++j)
//        {
//            cout << arr[i][j];
//        }
//        cout << endl;
//    }
}

int compare_plants(int x, int y)
{
	if(arr[x][y]) return 1;
	else if(arr[y][x]) return -1;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 63 ms 3192 KB Output is correct
7 Runtime error 417 ms 46472 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 3 ms 768 KB Output is correct
6 Correct 1730 ms 5368 KB Output is correct
7 Execution timed out 4017 ms 27408 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 3 ms 768 KB Output is correct
6 Correct 1730 ms 5368 KB Output is correct
7 Execution timed out 4017 ms 27408 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Execution timed out 4027 ms 11876 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 896 KB Output is correct
7 Correct 43 ms 2168 KB Output is correct
8 Correct 59 ms 2304 KB Output is correct
9 Correct 51 ms 2168 KB Output is correct
10 Correct 59 ms 2176 KB Output is correct
11 Correct 45 ms 2048 KB Output is correct
12 Correct 48 ms 2296 KB Output is correct
13 Correct 63 ms 2296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1343 ms 5496 KB Output is correct
6 Runtime error 100 ms 18680 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 63 ms 3192 KB Output is correct
7 Runtime error 417 ms 46472 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -