제출 #729094

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
7290942023-04-23 13:52:55kirakaminski968저울 (IOI15_scales)C++17
100 / 100
74 ms632 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
vector<vector<int>> allPerm;
vector<pair<int, vector<int>>> OP;
int ask[MAXN];
int nxt[MAXN][4];
int done[MAXN];
int timer = 0;
bool init(int cur, int sz, vector<int> index) {
if (index.size() <= 1) {
if (index.size() == 1) {
done[cur] = 1;
ask[cur] = index[0];
}
return 1;
}
for (int z = 0; z < OP.size(); z++) {
int op = OP[z].first;
vector<int> ques = OP[z].second;
bool ok = 1;
vector<int> ans[3];
for (int id : index) {
int a[3], b[6];
for (int i = 0; i < 3; i++) a[i] = allPerm[id][ques[i]];
sort(a, a + 3);
for (int i = 0; i < 3; i++) b[allPerm[id][ques[i]]] = i;
if (op == 0) { // min
ans[b[a[0]]].emplace_back(id);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

scales.cpp: In function 'bool init(int, int, std::vector<int>)':
scales.cpp:19:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::vector<int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for (int z = 0; z < OP.size(); z++) {
      |                         ~~^~~~~~~~~~~
scales.cpp:47:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |                 if (ans[0].size() > sz / 3) continue;
      |                     ~~~~~~~~~~~~~~^~~~~~~~
scales.cpp:48:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |                 if (ans[1].size() > sz / 3) continue;
      |                     ~~~~~~~~~~~~~~^~~~~~~~
scales.cpp:49:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   49 |                 if (ans[2].size() > sz / 3) continue;
      |                     ~~~~~~~~~~~~~~^~~~~~~~
scales.cpp: In function 'void init(int)':
scales.cpp:75:44: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   75 |                                 if (i >> j & 1 ^ 1) {
      |                                     ~~~~~~~^~~
scales.cpp:59:15: warning: unused parameter 'T' [-Wunused-parameter]
   59 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...