Submission #1041375

# Submission time Handle Problem Language Result Execution time Memory
1041375 2024-08-02T00:37:52 Z vjudge1 Comparing Plants (IOI20_plants) C++17
14 / 100
4000 ms 13652 KB
#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
int n, pos[100100],CA;
vector<int> R;
set<int> CD;
void init(int k, std::vector<int> r) {
    R=r;
    n=r.size();
    for(int i=0;i<n;i++)
        if(!r[i])
            CD.insert(i);
    while(CD.size()){
        int bst=*CD.begin(),gp=*CD.begin()+n-*--CD.end();
        auto it=++CD.begin();
        while(it!=CD.end()){
            int G=*it-*prev(it);
            if(G>gp)
                gp=G,bst=*it;
            it++;
        }
        pos[bst]=++CA;
        CD.erase(bst);
        for(int i=1;i<k;i++){
            int c=(bst+n-i)%n;
            if(!--R[c])
                CD.insert(c);
        }
    }
}
int compare_plants(int x, int y) {
    return pos[x]<pos[y]?1:-1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 348 KB Output is correct
4 Correct 0 ms 448 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 63 ms 5012 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 62 ms 5108 KB Output is correct
11 Correct 100 ms 5200 KB Output is correct
12 Correct 51 ms 5160 KB Output is correct
13 Correct 69 ms 5012 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 348 KB Output is correct
4 Correct 0 ms 448 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 63 ms 5012 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 62 ms 5108 KB Output is correct
11 Correct 100 ms 5200 KB Output is correct
12 Correct 51 ms 5160 KB Output is correct
13 Correct 69 ms 5012 KB Output is correct
14 Correct 406 ms 5712 KB Output is correct
15 Runtime error 36 ms 13652 KB Execution killed with signal 11
16 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 30 ms 4908 KB Output is correct
4 Execution timed out 4061 ms 11200 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 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 344 KB Output is correct
2 Correct 0 ms 344 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 344 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 -