답안 #751735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
751735 2023-06-01T10:47:46 Z tolbi 식물 비교 (IOI20_plants) C++17
14 / 100
4000 ms 9464 KB
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;}
template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;}
template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;}
#define int long long
#define endl '\n'
#define vint(x) vector<int> x
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(),x.end())
#define sortrarr(x) sort(x.rbegin(),x.rend())
#define det(x) cout<<"NO\0YES"+x*3<<endl;
#define INF LONG_LONG_MAX
#define rev(x) reverse(x.begin(),x.end());
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tol(bi) (1LL<<((int)(bi)))
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#ifdef tolbi
#else
#include "plants.h"
#endif
vector<int> arr;
void init(int32_t k, vector<int32_t> r) {
	int n = r.size();
	arr.resize(n);
	for (int i = 0; i < n; i++){
		int pos=23;
		for (int j = 0; j < n; j++){
			if (r[j]==0){
				pos=j;
				break;
			}
		}
		int lel = 0;
		for (int j = 1; j <= n; j++){
			if (r[(j+pos)%n]==0 && j-lel>=k){
				pos=(j+pos)%n;
				break;
			}
			if (r[(j+pos)%n]==0) lel = j;
		}
		for (int j = 0; j < k; j++){
			r[(pos+n-j)%n]--;
		}
		arr[pos]=i;
	}
}
int32_t compare_plants(int32_t x, int32_t y) {
	if (arr[x]<arr[y]) return 1;
	return -1;
}



#ifdef tolbi
static int32_t n, k, q;
static vector<int32_t> r;
static  vector<int32_t> x;
static  vector<int32_t> y;
static  vector<int32_t> answer;
int32_t main() {
	assert(scanf("%d%d%d", &n, &k, &q) == 3);
	r.resize(n);
	answer.resize(q);
	for (int32_t i = 0; i < n; i++) {
		int32_t value;
		assert(scanf("%d", &value) == 1);
		r[i] = value;
	}
	x.resize(q);
	y.resize(q);
	for (int32_t i = 0; i < q; i++) {
		assert(scanf("%d%d", &x[i], &y[i]) == 2);
	}
	fclose(stdin);

	init(k, r);
	for (int32_t i = 0; i < q; i++) {
		answer[i] = compare_plants(x[i], y[i]);
	}

	for (int32_t i = 0; i < q; i++) {
		printf("%d\n", answer[i]);
	}

	fclose(stdout);

	return 0;
}
#endif

Compilation message

plants.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 11 ms 412 KB Output is correct
7 Correct 258 ms 5008 KB Output is correct
8 Correct 3 ms 312 KB Output is correct
9 Correct 12 ms 416 KB Output is correct
10 Correct 262 ms 5100 KB Output is correct
11 Correct 219 ms 4944 KB Output is correct
12 Correct 237 ms 5140 KB Output is correct
13 Correct 279 ms 5008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 11 ms 412 KB Output is correct
7 Correct 258 ms 5008 KB Output is correct
8 Correct 3 ms 312 KB Output is correct
9 Correct 12 ms 416 KB Output is correct
10 Correct 262 ms 5100 KB Output is correct
11 Correct 219 ms 4944 KB Output is correct
12 Correct 237 ms 5140 KB Output is correct
13 Correct 279 ms 5008 KB Output is correct
14 Correct 2830 ms 5644 KB Output is correct
15 Execution timed out 4054 ms 9464 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 54 ms 3056 KB Output is correct
4 Execution timed out 4058 ms 8680 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -