답안 #300616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
300616 2020-09-17T10:28:37 Z CodePlatina 식물 비교 (IOI20_plants) C++14
14 / 100
353 ms 28024 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 512 KB Output is correct
5 Incorrect 1 ms 384 KB Output isn't correct
6 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 768 KB Output is correct
6 Correct 13 ms 5376 KB Output is correct
7 Correct 305 ms 27896 KB Output is correct
8 Correct 2 ms 768 KB Output is correct
9 Correct 13 ms 5376 KB Output is correct
10 Correct 280 ms 28024 KB Output is correct
11 Correct 149 ms 27472 KB Output is correct
12 Correct 165 ms 27640 KB Output is correct
13 Correct 353 ms 27896 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 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 768 KB Output is correct
6 Correct 13 ms 5376 KB Output is correct
7 Correct 305 ms 27896 KB Output is correct
8 Correct 2 ms 768 KB Output is correct
9 Correct 13 ms 5376 KB Output is correct
10 Correct 280 ms 28024 KB Output is correct
11 Correct 149 ms 27472 KB Output is correct
12 Correct 165 ms 27640 KB Output is correct
13 Correct 353 ms 27896 KB Output is correct
14 Runtime error 63 ms 5496 KB Execution killed with signal 11
15 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 Incorrect 77 ms 11128 KB Output isn't correct
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 Incorrect 1 ms 256 KB Output isn't correct
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 Incorrect 1 ms 512 KB Output isn't correct
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 256 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Incorrect 1 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -