Submission #1043844

# Submission time Handle Problem Language Result Execution time Memory
1043844 2024-08-04T23:44:04 Z aaaaaarroz Comparing Plants (IOI20_plants) C++17
14 / 100
4000 ms 13676 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 1 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 65 ms 5012 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 456 KB Output is correct
10 Correct 62 ms 5188 KB Output is correct
11 Correct 105 ms 5100 KB Output is correct
12 Correct 53 ms 5260 KB Output is correct
13 Correct 83 ms 5024 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 65 ms 5012 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 456 KB Output is correct
10 Correct 62 ms 5188 KB Output is correct
11 Correct 105 ms 5100 KB Output is correct
12 Correct 53 ms 5260 KB Output is correct
13 Correct 83 ms 5024 KB Output is correct
14 Correct 381 ms 5804 KB Output is correct
15 Runtime error 38 ms 13676 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 31 ms 4976 KB Output is correct
4 Execution timed out 4046 ms 11096 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 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 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 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -