Submission #1064916

# Submission time Handle Problem Language Result Execution time Memory
1064916 2024-08-18T19:21:16 Z Zicrus Comparing Plants (IOI20_plants) C++17
14 / 100
4000 ms 9552 KB
#include <bits/stdc++.h>
#include "plants.h"
using namespace std;

typedef long long ll;

ll n1;
ll val;
vector<ll> a1;

void init(int k, vector<int> r) {
    n1 = r.size();
    val = n1;
    a1 = vector<ll>(n1);
    while (val > 0) {
        ll id = 0;
        for (int i = n1-1; i >= 0; i--) {
            if (r[i] == 0) {
                id = i;
                break;
            }
        }
        ll finId = id;
        for (int i = 1; i < k && id > 0; i++) {
            id--;
            if (r[id] == 0) {
                i = 1;
                finId = id;
            }
        }
        a1[finId] = val--;
        for (int i = 1; i < k; i++) {
            ll tId = (finId - i + n1) % n1;
            r[tId]--;
        }
        r[finId] = 1 << 30;
    }
}

int compare_plants(int x, int y) {
	return a1[x] > a1[y] ? 1 : -1;
}

#ifdef TEST
#include "grader.cpp"
#endif
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 416 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 544 KB Output is correct
7 Correct 105 ms 5204 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 101 ms 5204 KB Output is correct
11 Correct 79 ms 5004 KB Output is correct
12 Correct 79 ms 5204 KB Output is correct
13 Correct 115 ms 5180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 416 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 544 KB Output is correct
7 Correct 105 ms 5204 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 101 ms 5204 KB Output is correct
11 Correct 79 ms 5004 KB Output is correct
12 Correct 79 ms 5204 KB Output is correct
13 Correct 115 ms 5180 KB Output is correct
14 Correct 828 ms 5576 KB Output is correct
15 Execution timed out 4035 ms 9552 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 35 ms 4956 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -