답안 #388013

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
388013 2021-04-09T18:11:56 Z Supersonic 식물 비교 (IOI20_plants) C++17
0 / 100
1 ms 208 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
int a[400001];int b[400001];int n;
void init(int k, std::vector<int> r) {
	if(k==2){
		n=r.size();
		for(int i=0;i<n;i++)r.push_back(r[i]);
		for(int i=0;i<2*n;i++)b[i]=r[i];
		a[0]=0;
		for(int i=1;i<2*n;i++){if(r[i]==r[i-1])a[i]=a[i-1];else a[i]=a[i-1]+1;}
	}
	return;
}

int compare_plants(int x, int y) {
	//cerr<<x<<' '<<y<<endl;
	if(x>y)y+=n;y--;
	if(a[x]==a[y]){
		//cerr<<b.size()<<endl;
		if(b[x]==0)return 1;
		else return -1;
	}
	return 0;
}

Compilation message

plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:18:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   18 |  if(x>y)y+=n;y--;
      |  ^~
plants.cpp:18:14: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   18 |  if(x>y)y+=n;y--;
      |              ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -