답안 #310317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
310317 2020-10-06T16:19:50 Z APROHACK 식물 비교 (IOI20_plants) C++14
5 / 100
114 ms 7280 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>globalr;
long long gk, gn;
vector<int>acum;
void init(int k, vector<int> r) {
    globalr=r;
    gk=k;
    gn=r.size();
    acum.push_back(0);
    long long cur=0;
    for(int i = 0 ; i < r.size() ; i ++){
        acum.push_back(cur+r[i]);
        cur+=r[i];
    }
    for(int i = 0 ; i < r.size() ; i ++){
        acum.push_back(cur+r[i]);
        cur+=r[i];
    }
	return;
}

int compare_plants(int x, int y) {
    long long rta1, rta2;
    rta1=acum[y]-acum[x];
    if(rta1==0){
        return 1;
    }else if(rta1==y-x)return -1;
    else
    {
        rta2=acum[(x+gn)]-acum[(y)];
        if(rta2==0){
            return -1;
        }else if(rta2==(x+gn)-y){
            return 1;
        }else return 0;
    }
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i = 0 ; i < r.size() ; i ++){
      |                     ~~^~~~~~~~~~
plants.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i = 0 ; i < r.size() ; i ++){
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 64 ms 3192 KB Output is correct
7 Correct 86 ms 3700 KB Output is correct
8 Correct 111 ms 7280 KB Output is correct
9 Correct 111 ms 7276 KB Output is correct
10 Correct 114 ms 7148 KB Output is correct
11 Correct 110 ms 7148 KB Output is correct
12 Correct 112 ms 7148 KB Output is correct
13 Correct 104 ms 7148 KB Output is correct
14 Correct 113 ms 7148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 64 ms 3192 KB Output is correct
7 Correct 86 ms 3700 KB Output is correct
8 Correct 111 ms 7280 KB Output is correct
9 Correct 111 ms 7276 KB Output is correct
10 Correct 114 ms 7148 KB Output is correct
11 Correct 110 ms 7148 KB Output is correct
12 Correct 112 ms 7148 KB Output is correct
13 Correct 104 ms 7148 KB Output is correct
14 Correct 113 ms 7148 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Incorrect 1 ms 256 KB Output isn't correct
18 Halted 0 ms 0 KB -