제출 #357651

#제출 시각아이디문제언어결과실행 시간메모리
357651dooweyComparing Plants (IOI20_plants)C++14
0 / 100
65 ms4908 KiB
#include <bits/stdc++.h>
#include "plants.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define fi first
#define se scond
#define mp make_pair

const int N = (int)2e5 + 100;
int A[N];
int vl[N];

void init(int k, vector<int> r) {
    int n = r.size();
    for(int i = 0 ; i < n; i ++ ){
        if(r[i] == 0){
            for(int j = 1; j < k ; j ++ ){
                vl[(i + j) % n] ++ ;
            }
        }
    }
    for(int id = n - 1; id >= 0; id -- ){
        for(int q = 0; q < n; q ++ ){
            if(vl[q] == 0 && r[q] == 0){
                A[q] = id;
                vl[q] = (int)1e9;
                for(int j = 1; j < k ; j ++ ){
                    r[(q - j + n) % n] -- ;
                    vl[(q + j) % n] -- ;
                }
                break;
            }
        }
    }
}

int compare_plants(int x, int y) {
    if(A[x] < A[y]) return -1;
    return +1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...