Submission #310319

# Submission time Handle Problem Language Result Execution time Memory
310319 2020-10-06T16:25:12 Z APROHACK Comparing Plants (IOI20_plants) C++14
0 / 100
1 ms 308 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 -999;
        }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 ++){
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 1 ms 308 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -