답안 #1028742

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1028742 2024-07-20T08:02:41 Z parsadox2 커다란 상품 (IOI17_prize) C++17
20 / 100
619 ms 4020 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 10;
int n , cnt[N];
bool marked[N] , dead[N];

int Sq(int val)
{
	for(int i = 1 ; i <= val ; i++)  if(i * i >= val)
		return i;
	return -1;
}

int Solve()
{
	int sq = Sq(n);
	int mx = 0;
	for(int i = 0 ; i < sq ; i++)
	{
		auto now = ask(i);
		mx = max(mx , now[0] + now[1]);
	}
	for(int asd = 0 ; asd < mx ; asd++)
	{
		vector <int> all;
		int tmp = 0;
		for(int i = 0 ; i < n ; i++) if(!dead[i])
		{
			if(marked[i])
				tmp++;
			else
			{
				cnt[i] = tmp;
				all.push_back(i);
			}
		}
		int low = -1 , high = all.size();
		while(high - low > 1)
		{
			int mid = (low + high) >> 1;
			int id = all[mid];
			auto now = ask(id);
			if(now[0] + now[1] != mx)
			{
				marked[id] = true;
				break;
			}
			now[0] -= cnt[id];
			if(now[0] != 0)
				high = mid;
			else
				low = mid;
			dead[id] = true;
		}
	}
	for(int i = 0 ; i < n ; i++)  if(marked[i])
	{
		auto now = ask(i);
		if(now[0] + now[1] == 0)
			return i;
	}
	return -1;
}

int find_best(int nn) {
	n = nn;
	if(n == 1)
		return 0;
	return Solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2000 KB Output is correct
2 Correct 3 ms 2252 KB Output is correct
3 Correct 4 ms 2000 KB Output is correct
4 Correct 4 ms 2100 KB Output is correct
5 Correct 4 ms 2000 KB Output is correct
6 Correct 5 ms 2000 KB Output is correct
7 Correct 3 ms 2000 KB Output is correct
8 Correct 4 ms 2000 KB Output is correct
9 Correct 4 ms 2000 KB Output is correct
10 Correct 4 ms 2100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 2000 KB Output is correct
2 Correct 5 ms 2000 KB Output is correct
3 Correct 5 ms 2000 KB Output is correct
4 Correct 4 ms 2252 KB Output is correct
5 Correct 3 ms 2252 KB Output is correct
6 Correct 4 ms 2096 KB Output is correct
7 Correct 5 ms 2000 KB Output is correct
8 Correct 3 ms 2096 KB Output is correct
9 Correct 4 ms 2000 KB Output is correct
10 Correct 3 ms 2000 KB Output is correct
11 Correct 43 ms 3416 KB Output is correct
12 Correct 42 ms 3392 KB Output is correct
13 Correct 43 ms 3436 KB Output is correct
14 Correct 29 ms 816 KB Output is correct
15 Partially correct 527 ms 3404 KB Partially correct - number of queries: 7900
16 Partially correct 559 ms 3628 KB Partially correct - number of queries: 8693
17 Partially correct 558 ms 3984 KB Partially correct - number of queries: 8364
18 Partially correct 531 ms 3448 KB Partially correct - number of queries: 8748
19 Partially correct 536 ms 3468 KB Partially correct - number of queries: 7817
20 Partially correct 181 ms 2064 KB Partially correct - number of queries: 5527
21 Partially correct 497 ms 3528 KB Partially correct - number of queries: 8378
22 Partially correct 413 ms 3996 KB Partially correct - number of queries: 6203
23 Correct 11 ms 3328 KB Output is correct
24 Correct 35 ms 3312 KB Output is correct
25 Partially correct 483 ms 3996 KB Partially correct - number of queries: 8428
26 Partially correct 488 ms 3748 KB Partially correct - number of queries: 8539
27 Correct 10 ms 3096 KB Output is correct
28 Partially correct 476 ms 3536 KB Partially correct - number of queries: 8629
29 Partially correct 454 ms 3664 KB Partially correct - number of queries: 7067
30 Partially correct 572 ms 3700 KB Partially correct - number of queries: 8652
31 Partially correct 564 ms 3744 KB Partially correct - number of queries: 8162
32 Correct 59 ms 3404 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Partially correct 578 ms 3460 KB Partially correct - number of queries: 8340
35 Correct 21 ms 3232 KB Output is correct
36 Partially correct 560 ms 3436 KB Partially correct - number of queries: 8290
37 Correct 43 ms 3316 KB Output is correct
38 Correct 14 ms 3196 KB Output is correct
39 Partially correct 619 ms 3528 KB Partially correct - number of queries: 8398
40 Partially correct 441 ms 3480 KB Partially correct - number of queries: 7456
41 Partially correct 504 ms 3436 KB Partially correct - number of queries: 8539
42 Partially correct 611 ms 3524 KB Partially correct - number of queries: 8539
43 Partially correct 529 ms 3508 KB Partially correct - number of queries: 8248
44 Partially correct 546 ms 3788 KB Partially correct - number of queries: 8443
45 Partially correct 544 ms 3624 KB Partially correct - number of queries: 8333
46 Partially correct 580 ms 4020 KB Partially correct - number of queries: 8215
47 Partially correct 498 ms 3552 KB Partially correct - number of queries: 8389
48 Partially correct 499 ms 3724 KB Partially correct - number of queries: 8664
49 Partially correct 468 ms 3648 KB Partially correct - number of queries: 8251
50 Partially correct 471 ms 3736 KB Partially correct - number of queries: 8742
51 Partially correct 551 ms 3472 KB Partially correct - number of queries: 8453
52 Partially correct 504 ms 3460 KB Partially correct - number of queries: 8218
53 Correct 10 ms 3188 KB Output is correct
54 Partially correct 487 ms 3516 KB Partially correct - number of queries: 8451
55 Partially correct 509 ms 3744 KB Partially correct - number of queries: 8263
56 Partially correct 473 ms 3476 KB Partially correct - number of queries: 8749
57 Partially correct 519 ms 3804 KB Partially correct - number of queries: 8563
58 Partially correct 501 ms 3732 KB Partially correct - number of queries: 8594
59 Partially correct 523 ms 3520 KB Partially correct - number of queries: 8538
60 Partially correct 480 ms 3708 KB Partially correct - number of queries: 8490
61 Correct 10 ms 3188 KB Output is correct
62 Correct 11 ms 3188 KB Output is correct
63 Correct 12 ms 3188 KB Output is correct
64 Correct 11 ms 3188 KB Output is correct
65 Correct 39 ms 3128 KB Output is correct
66 Partially correct 522 ms 3268 KB Partially correct - number of queries: 5929
67 Partially correct 470 ms 3204 KB Partially correct - number of queries: 5426
68 Partially correct 477 ms 3252 KB Partially correct - number of queries: 5674
69 Partially correct 527 ms 3644 KB Partially correct - number of queries: 5912
70 Correct 365 ms 3284 KB Output is correct
71 Partially correct 554 ms 3772 KB Partially correct - number of queries: 9416
72 Correct 37 ms 3452 KB Output is correct
73 Partially correct 548 ms 3560 KB Partially correct - number of queries: 9283
74 Partially correct 537 ms 3564 KB Partially correct - number of queries: 9340
75 Correct 12 ms 3236 KB Output is correct
76 Partially correct 474 ms 3532 KB Partially correct - number of queries: 8048
77 Partially correct 516 ms 3596 KB Partially correct - number of queries: 8742
78 Correct 45 ms 3332 KB Output is correct
79 Correct 256 ms 3924 KB Output is correct
80 Partially correct 542 ms 3580 KB Partially correct - number of queries: 8835
81 Partially correct 534 ms 3584 KB Partially correct - number of queries: 8800
82 Partially correct 574 ms 3548 KB Partially correct - number of queries: 8653
83 Correct 13 ms 3188 KB Output is correct
84 Partially correct 449 ms 3784 KB Partially correct - number of queries: 7240
85 Partially correct 567 ms 3784 KB Partially correct - number of queries: 8762
86 Incorrect 30 ms 3084 KB Integer -1 violates the range [0, 199999]
87 Halted 0 ms 0 KB -