답안 #955582

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
955582 2024-03-31T04:06:58 Z ono_de206 Toxic Gene (NOI23_toxic) C++17
16.8462 / 100
6 ms 704 KB
#include "toxic.h"
#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

//#define int long long

typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

void determine_type(int n) {
	vector<int> type(n + 1, -1);
	auto dfs = [&](auto &self, int l, int r) {
		vector<int> ask(r - l + 1);
		iota(all(ask), l);
		if(query_sample(ask) == r - l + 1) return;
		if(l == r) type[l] = 1;
		else {
			int m = (l + r) / 2;
			self(self, l, m);
			self(self, m + 1, r);
		}
	};
	dfs(dfs, 1, n);
	vector<int> non;
	int samp;
	for(int i = 1; i <= n; i++) {
		if(type[i] == -1) non.pb(i);
		else samp = i;
	}
	for(int l = 0, r; l < non.size(); l = r) {
		r = min((int)non.size(), l + 7);
		vector<int> ask{samp};
		for(int j = l; j < r; j++) {
			int cnt = (1 << (j - l));
			for(int _ = 0; _ < cnt; _++) {
				ask.pb(non[j]);
			}
		}
		int ans = query_sample(ask);
		for(int j = l; j < r; j++) {
			int cnt = (1 << (j - l));
			if(ans & cnt) type[non[j]] = 0;
			else type[non[j]] = 2;
		}
	}
	string str = "STR";
	for(int i = 1; i <= n; i++) {
		answer_type(i, str[type[i]]);
	}
}

Compilation message

toxic.cpp: In function 'void determine_type(int)':
toxic.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  for(int l = 0, r; l < non.size(); l = r) {
      |                    ~~^~~~~~~~~~~~
toxic.cpp:36:6: warning: 'samp' may be used uninitialized in this function [-Wmaybe-uninitialized]
   36 |  int samp;
      |      ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Partially correct 3 ms 348 KB Partially correct
3 Partially correct 4 ms 348 KB Partially correct
4 Partially correct 4 ms 348 KB Partially correct
5 Partially correct 4 ms 356 KB Partially correct
6 Partially correct 4 ms 384 KB Partially correct
7 Partially correct 4 ms 532 KB Partially correct
8 Partially correct 5 ms 500 KB Partially correct
9 Partially correct 4 ms 348 KB Partially correct
10 Partially correct 5 ms 348 KB Partially correct
11 Partially correct 5 ms 344 KB Partially correct
12 Partially correct 5 ms 500 KB Partially correct
13 Partially correct 4 ms 348 KB Partially correct
14 Partially correct 4 ms 348 KB Partially correct
15 Partially correct 6 ms 348 KB Partially correct
16 Partially correct 4 ms 508 KB Partially correct
17 Partially correct 4 ms 348 KB Partially correct
18 Partially correct 4 ms 348 KB Partially correct
19 Partially correct 5 ms 508 KB Partially correct
20 Partially correct 5 ms 496 KB Partially correct
21 Partially correct 5 ms 348 KB Partially correct
22 Partially correct 4 ms 348 KB Partially correct
23 Partially correct 4 ms 348 KB Partially correct
24 Correct 3 ms 348 KB Output is correct
25 Correct 4 ms 348 KB Output is correct
26 Correct 4 ms 348 KB Output is correct
27 Correct 3 ms 348 KB Output is correct
28 Correct 3 ms 348 KB Output is correct
29 Correct 4 ms 512 KB Output is correct
30 Correct 3 ms 704 KB Output is correct
31 Correct 3 ms 352 KB Output is correct
32 Correct 3 ms 612 KB Output is correct
33 Correct 3 ms 348 KB Output is correct
34 Partially correct 5 ms 532 KB Partially correct
35 Partially correct 4 ms 540 KB Partially correct
36 Partially correct 1 ms 440 KB Partially correct