Submission #623035

# Submission time Handle Problem Language Result Execution time Memory
623035 2022-08-05T06:11:07 Z Siffer Comparing Plants (IOI20_plants) C++14
0 / 100
1 ms 304 KB
#include "plants.h"
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second

vector<pair<int,int>> v;

void init(int p, vector<int> r) {
    int n = r.size();
    int s = 0; for(;r[s]; s++); s++;
    v.resize(n);
    int b = s % n;
    int k = 0;
    for(int i = 0; i < n; i++) {
        v[(s+i)%n] = {b, k++};
        if(r[(s+i)%n] == 0) b = (s+i+1)%n, k = 0;
    }
}

int compare_plants(int x, int y) {
    if(v[x].F != v[y].F) return 0;
    if(v[x].S > v[y].S) return 1;
    return -1;
}


# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 296 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 300 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 300 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 304 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 296 KB Output isn't correct
5 Halted 0 ms 0 KB -