답안 #331972

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331972 2020-11-30T21:24:42 Z pggp 식물 비교 (IOI20_plants) C++14
0 / 100
1 ms 492 KB
#include <bits/stdc++.h>

using namespace std;

int K;
vector < int > R;
int n;
vector < int > order;
int ord;

void init(int k, vector < int > r){
	K = k;
	R = r;
	n = R.size();
	order.resize(n);

	int last_up = 0;
	for (int i = 0; i < n; ++i)
	{
		for(int ind = 0; ind < n; ind++){
			if(R[ind] == 0){
				for(int c = 0; c <= k; c++){
					R[ind - c]--;
				}
				order[ind] = ord;
				ord++;
			}
		}
	}
}

int compare_plants(int x, int y){
	if(order[x] > order[y]){
		return 1;
	}
	if(order[y] > order[x]){
		return -1;
	}
	return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:17:6: warning: unused variable 'last_up' [-Wunused-variable]
   17 |  int last_up = 0;
      |      ^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -