# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
835577 | rubdary | Comparing Plants (IOI20_plants) | C++14 | 0 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "plants.h"
#include <iostream>
using namespace std;
int N;
vector <int> sum;
void init(int k, vector<int> r){
sum.push_back(0);
for(int i = 0; i < r.size(); i++){
sum.push_back(sum.back()+r[i]);
}
return;
}
int lower(int x, int y){
int suma = sum[y] - sum[x];
int cant = y - x + 1;
if(suma == 0) return 1;
if(suma == cant) return -1;
suma = (sum.back() - sum[y]) + (sum[x]);
cant = N - cant;
if(suma == 0) return -1;
if(suma == cant) return 1;
return 0;
}
int higher(int x, int y){
int suma = sum[x] - sum[y];
int cant = x - y + 1;
if(suma == 0) return -1;
if(suma == cant) return 1;
suma = (sum.back() - sum[x]) + (sum[y]);
cant = N - cant;
if(suma == 0) return 1;
if(suma == cant) return -1;
return 0;
}
int compare_plants(int x, int y){
N = sum.size();
if(x < y) return lower(x, y);
return higher(x, y);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |