# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078166 | 2024-08-27T13:28:21 Z | mindiyak | Comparing Plants (IOI20_plants) | C++14 | 1 ms | 600 KB |
#include "plants.h" #include <iostream> using namespace std; #define F first #define S second vector<pair<int,int>> R; vector<int> pos; vector<int> m; int N; void init(int k, std::vector<int> r) { int start = 0; int len = 1; pos.push_back(R.size()); N = r.size(); for(int l=1;l<r.size()*2;l++){ int i = l%r.size(); if(r[i] == r[start]){ len ++; }else{ R.push_back({start,len}); start = i; len = 1; } pos.push_back(R.size()); } m = r; return; } int compare_plants(int x, int y) { int a=x; // cerr << x << " " << y << endl; a = pos[x]; if(m[R[a].F] == 0){ if(R[a].S == (y-x)) return 1; } a = pos[y]; if(m[R[a].F] == 1){ if(R[a].S == (N-y+x)) return 1; } a = pos[x]; if(m[R[a].F] == 1){ if(R[a].S == (y-x)) return -1; } a = pos[y]; if(m[R[a].F] == 0){ if(R[a].S == (N-y+x)) return -1; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 432 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 432 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 600 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |