제출 #580846

#제출 시각아이디문제언어결과실행 시간메모리
580846joelau식물 비교 (IOI20_plants)C++14
0 / 100
1 ms340 KiB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;

int N,ans[200005];
vector<int> tmp;

void init(int k, vector<int> r) {
	N = r.size();
	for (int i = 0; i < N; ++i) {
		tmp.clear();
		for (int j = 0; j < N; ++j) if (r[j] == 0) tmp.push_back(j);
		int n = tmp[0];
		for (int j = 1; j < tmp.size(); ++j) if (tmp[j]-tmp[j-1] >= k) n = tmp[j];
		ans[n] = N-i;
		tmp[n] = 2e9;
		for (int j = 1; j < k; ++j) tmp[(n-j+N)%N]--;
	}
}

int compare_plants(int x, int y) {
	return ans[x] > ans[y] ? 1 : -1;
}

컴파일 시 표준 에러 (stderr) 메시지

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:14:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   for (int j = 1; j < tmp.size(); ++j) if (tmp[j]-tmp[j-1] >= k) n = tmp[j];
      |                   ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...