Submission #1048525

# Submission time Handle Problem Language Result Execution time Memory
1048525 2024-08-08T08:07:20 Z IUA_Hasin Comparing Plants (IOI20_plants) C++17
0 / 100
1 ms 688 KB
#include "plants.h"
#include <bits/stdc++.h>

#define ll						long long

using namespace std;

ll a, n;
vector<ll> arr;

void init(int k, std::vector<int> r) {
	a = k;
	n = r.size();
	for(int i=0; i<r.size(); i++){
		arr.push_back(r[i]);
	}

	return;
}

int compare_plants(int x, int y) {
	ll temp = arr[x];
	ll temp2 = arr[y];
	if(y==n-1){
		if(x==0){
			if(temp2>0){
				return -1;
			} else {
				return 1;
			}
		} else {
			return 0;
		}
	} else {
		if(y==x+1){
			if(temp>0){
				return 1;
			} else {
				return -1;
			}
		} else {
			return 0;
		}
	}
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:14:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i=0; i<r.size(); i++){
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -