답안 #1028757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1028757 2024-07-20T08:16:37 Z parsadox2 커다란 상품 (IOI17_prize) C++17
20 / 100
637 ms 4584 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 val;
}

int Solve()
{
	int Q = 0;
	int sq = Sq(n);
	int mx = 0;
	for(int i = 0 ; i < min(n , sq + 2) ; i++)
	{
		Q++;
		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)
		{
			Q++;
			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])
	{
		Q++;
		auto now = ask(i);
		if(now[0] + now[1] == 0)
			return i;
	}
	for(int i = 0 ; i < n ; i++)  if(Q < 10000)
	{
		Q++;
		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 3 ms 2012 KB Output is correct
2 Correct 5 ms 2000 KB Output is correct
3 Correct 4 ms 2000 KB Output is correct
4 Correct 4 ms 2000 KB Output is correct
5 Correct 4 ms 2100 KB Output is correct
6 Correct 3 ms 2096 KB Output is correct
7 Correct 3 ms 2000 KB Output is correct
8 Correct 4 ms 1996 KB Output is correct
9 Correct 4 ms 2000 KB Output is correct
10 Correct 4 ms 2000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2000 KB Output is correct
2 Correct 4 ms 2000 KB Output is correct
3 Correct 3 ms 2000 KB Output is correct
4 Correct 4 ms 2256 KB Output is correct
5 Correct 3 ms 2000 KB Output is correct
6 Correct 4 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 3 ms 2000 KB Output is correct
10 Correct 4 ms 2000 KB Output is correct
11 Correct 45 ms 3380 KB Output is correct
12 Correct 42 ms 3368 KB Output is correct
13 Correct 40 ms 3420 KB Output is correct
14 Correct 24 ms 776 KB Output is correct
15 Partially correct 550 ms 3648 KB Partially correct - number of queries: 7902
16 Partially correct 524 ms 3548 KB Partially correct - number of queries: 8695
17 Partially correct 527 ms 3496 KB Partially correct - number of queries: 8366
18 Partially correct 557 ms 3696 KB Partially correct - number of queries: 8750
19 Partially correct 556 ms 3556 KB Partially correct - number of queries: 7819
20 Partially correct 218 ms 1948 KB Partially correct - number of queries: 5529
21 Partially correct 573 ms 3528 KB Partially correct - number of queries: 8380
22 Partially correct 404 ms 3760 KB Partially correct - number of queries: 6205
23 Correct 16 ms 3188 KB Output is correct
24 Correct 61 ms 3240 KB Output is correct
25 Partially correct 519 ms 3424 KB Partially correct - number of queries: 8430
26 Partially correct 627 ms 3460 KB Partially correct - number of queries: 8541
27 Correct 12 ms 3104 KB Output is correct
28 Partially correct 603 ms 3652 KB Partially correct - number of queries: 8631
29 Partially correct 411 ms 3464 KB Partially correct - number of queries: 7069
30 Partially correct 549 ms 3472 KB Partially correct - number of queries: 8654
31 Partially correct 612 ms 3472 KB Partially correct - number of queries: 8164
32 Correct 68 ms 3384 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Partially correct 588 ms 3456 KB Partially correct - number of queries: 8342
35 Correct 32 ms 3164 KB Output is correct
36 Partially correct 550 ms 3784 KB Partially correct - number of queries: 8292
37 Correct 59 ms 3248 KB Output is correct
38 Correct 15 ms 3172 KB Output is correct
39 Partially correct 563 ms 3468 KB Partially correct - number of queries: 8400
40 Partially correct 481 ms 3508 KB Partially correct - number of queries: 7458
41 Partially correct 570 ms 3788 KB Partially correct - number of queries: 8541
42 Partially correct 637 ms 3748 KB Partially correct - number of queries: 8541
43 Partially correct 554 ms 3572 KB Partially correct - number of queries: 8250
44 Partially correct 605 ms 3548 KB Partially correct - number of queries: 8445
45 Partially correct 559 ms 3432 KB Partially correct - number of queries: 8335
46 Partially correct 564 ms 3644 KB Partially correct - number of queries: 8217
47 Partially correct 621 ms 3636 KB Partially correct - number of queries: 8391
48 Partially correct 535 ms 3624 KB Partially correct - number of queries: 8666
49 Partially correct 521 ms 3436 KB Partially correct - number of queries: 8253
50 Partially correct 562 ms 3408 KB Partially correct - number of queries: 8744
51 Partially correct 540 ms 3916 KB Partially correct - number of queries: 8455
52 Partially correct 531 ms 4036 KB Partially correct - number of queries: 8220
53 Correct 11 ms 3188 KB Output is correct
54 Partially correct 524 ms 4148 KB Partially correct - number of queries: 8453
55 Partially correct 547 ms 3820 KB Partially correct - number of queries: 8265
56 Partially correct 528 ms 3604 KB Partially correct - number of queries: 8751
57 Partially correct 546 ms 4324 KB Partially correct - number of queries: 8565
58 Partially correct 508 ms 3876 KB Partially correct - number of queries: 8596
59 Partially correct 535 ms 3568 KB Partially correct - number of queries: 8540
60 Partially correct 536 ms 3740 KB Partially correct - number of queries: 8492
61 Correct 12 ms 3188 KB Output is correct
62 Correct 11 ms 3188 KB Output is correct
63 Correct 13 ms 3188 KB Output is correct
64 Correct 13 ms 3188 KB Output is correct
65 Correct 41 ms 3136 KB Output is correct
66 Partially correct 501 ms 3184 KB Partially correct - number of queries: 5931
67 Partially correct 542 ms 3744 KB Partially correct - number of queries: 5428
68 Partially correct 513 ms 3444 KB Partially correct - number of queries: 5676
69 Partially correct 529 ms 3552 KB Partially correct - number of queries: 5914
70 Correct 324 ms 3668 KB Output is correct
71 Partially correct 532 ms 3520 KB Partially correct - number of queries: 9418
72 Correct 47 ms 3676 KB Output is correct
73 Partially correct 495 ms 3912 KB Partially correct - number of queries: 9285
74 Partially correct 556 ms 3500 KB Partially correct - number of queries: 9342
75 Correct 11 ms 3200 KB Output is correct
76 Partially correct 453 ms 3480 KB Partially correct - number of queries: 8050
77 Partially correct 576 ms 3604 KB Partially correct - number of queries: 8806
78 Correct 44 ms 3348 KB Output is correct
79 Correct 252 ms 3688 KB Output is correct
80 Partially correct 526 ms 3932 KB Partially correct - number of queries: 8785
81 Partially correct 549 ms 3756 KB Partially correct - number of queries: 8802
82 Partially correct 530 ms 3440 KB Partially correct - number of queries: 8710
83 Correct 12 ms 3188 KB Output is correct
84 Partially correct 442 ms 3512 KB Partially correct - number of queries: 7195
85 Partially correct 551 ms 4584 KB Partially correct - number of queries: 8666
86 Incorrect 91 ms 3068 KB Integer -1 violates the range [0, 199999]
87 Halted 0 ms 0 KB -