답안 #808554

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
808554 2023-08-05T07:50:38 Z drdilyor 식물 비교 (IOI20_plants) C++17
0 / 100
4000 ms 8660 KB
#include<bits/stdc++.h>
#include "plants.h"
using namespace std;
using ll = long long;
const int inf = 1e9;

#define debug(args...) cout << "[" << #args << "]: "; debug_out(args);
void debug_out() {
    cout << endl;
}
template<typename H, typename... T>
void debug_out(H h, T... t) {
    cout << h << ", ";
    debug_out(t...);
}

void vis() {
    int n = 7;
    int k = 4;

    vector<int> arr(n);
    iota(arr.begin(), arr.end(), 1);
    map<vector<int>, vector<int>> mp;
    do {
        vector<int> r;
        for (int i = 0; i < n; i++) {
            int cnt = 0;
            for (int j = i; j < i + k; j++)
                cnt += arr[j % n] > arr[i];
            r.push_back(cnt);
        }
        mp[r] = arr;
    }while (next_permutation(arr.begin(), arr.end()));
    for (auto[r, arr] : mp) {
        for (int i : r) cout << i << ' ';
        cout << "= ";
        for (int i : arr) cout << i << ' ';
        cout << endl;
    }

	return;
}

int n;
vector<int> p;
void init(int k, std::vector<int> r) {
    n = r.size();
    p.resize(n);
    vector<int> done(n);
    int cur = n;
    for (int i = 0; i < (int)r.size(); i++) {
        if (done[i]) continue;
        bool ok = r[i] == 0;
        for (int j = i - k + 1; j < i; j++) {
            int jj = (j+n) % n;
            if (done[jj]) continue;
            ok &= r[jj] > 0;
        }
        if (ok) {
            for (int j = i - k + 1; j < i; j++) {
                int jj = (j+n) % n;
                if( done[jj]) continue;
                r[(j + n) % n]--;
            }

            p[i] = cur--;
            done[i] = 1;
            i = -1;
        }
    }
}


int compare_plants(int x, int y) {
	return p[x] < p[y] ? -1 : 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 0 ms 300 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 874 ms 404 KB Output is correct
7 Execution timed out 4059 ms 3360 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 0 ms 300 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 874 ms 404 KB Output is correct
7 Execution timed out 4059 ms 3360 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 61 ms 3768 KB Output is correct
4 Execution timed out 4081 ms 8660 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -