Submission #1028149

#TimeUsernameProblemLanguageResultExecution timeMemory
1028149serifefedartarICC (CEOI16_icc)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "icc.h" using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); typedef long long ll; #define f first #define s second #define LOGN 20 const ll MOD = 1e9 + 7; const ll MAXN = 105; int par[MAXN], sz[MAXN], temp1[MAXN], temp2[MAXN]; int find(int node) { if (node == par[node]) return node; return par[node] = find(par[node]); } void unite(int a, int b) { a = find(a); b = find(b); if (a == b) return ; if (sz[b] > sz[a]) swap(a, b); sz[a] += sz[b]; par[b] = a; } int qry(int sz1, int sz2, vector<int> A, vector<int> B) { for (int i = 0; i < sz1; i++) temp1[i] = A[i]; for (int i = 0; i < sz2; i++) temp2[i] = B[i]; return query(sz1, sz2, temp1, temp2); } void dac(vector<vector<int>> arr) { while (true) { random_shuffle(arr.begin(), arr.end()); vector<int> A, B; for (int i = 0; i < arr.size() / 2; i++) { for (auto u : arr[i]) A.push_back(u); } for (int i = arr.size() / 2; i < arr.size(); i++) { for (auto u : arr[i]) B.push_back(u); } if (query(A.size(), B.size(), A, B)) { while ((int)BB.size() > 1) { vector<int> X, Y; for (int i = 0; i < (int)BB.size() / 2; i++) X.push_back(BB[i]); for (int i = (int)BB.size() / 2; i < (int)BB.size(); i++) Y.push_back(BB[i]); if (qry(AA.size(), X.size(), AA, X)) BB = X; else BB = Y; } while ((int)AA.size() > 1) { vector<int> X, Y; for (int i = 0; i < (int)AA.size() / 2; i++) X.push_back(AA[i]); for (int i = (int)AA.size() / 2; i < (int)AA.size(); i++) Y.push_back(AA[i]); if (qry(X.size(), 1, X, BB)) AA = X; else AA = Y; } setRoad(BB[0], AA[0]); unite(BB[0], AA[0]); return ; } } } int n; void solve() { map<int, vector<int>> mp; for (int i = 1; i <= n; i++) mp[find(i)].push_back(i); vector<vector<int>> temp; for (auto u : mp) temp.push_back(u.s); match(temp); } void run(int N) { n = N; for (int i = 1; i <= N; i++) sz[i] = 1, par[i] = i; for (int i = 1; i < N; i++) solve(); }

Compilation message (stderr)

icc.cpp: In function 'void dac(std::vector<std::vector<int> >)':
icc.cpp:44:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for (int i = 0; i < arr.size() / 2; i++) {
      |                         ~~^~~~~~~~~~~~~~~~
icc.cpp:48:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         for (int i = arr.size() / 2; i < arr.size(); i++) {
      |                                      ~~^~~~~~~~~~~~
icc.cpp:53:39: error: cannot convert 'std::vector<int>' to 'int*'
   53 |         if (query(A.size(), B.size(), A, B)) {
      |                                       ^
      |                                       |
      |                                       std::vector<int>
In file included from icc.cpp:2:
icc.h:10:30: note:   initializing argument 3 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |                         ~~~~~^
icc.cpp:55:25: error: 'BB' was not declared in this scope; did you mean 'B'?
   55 |             while ((int)BB.size() > 1) {
      |                         ^~
      |                         B
icc.cpp:62:25: error: 'AA' was not declared in this scope; did you mean 'A'?
   62 |                 if (qry(AA.size(), X.size(), AA, X))
      |                         ^~
      |                         A
icc.cpp:68:25: error: 'AA' was not declared in this scope; did you mean 'A'?
   68 |             while ((int)AA.size() > 1) {
      |                         ^~
      |                         A
icc.cpp:75:41: error: 'BB' was not declared in this scope; did you mean 'B'?
   75 |                 if (qry(X.size(), 1, X, BB))
      |                                         ^~
      |                                         B
icc.cpp:81:21: error: 'BB' was not declared in this scope; did you mean 'B'?
   81 |             setRoad(BB[0], AA[0]);
      |                     ^~
      |                     B
icc.cpp:81:28: error: 'AA' was not declared in this scope; did you mean 'A'?
   81 |             setRoad(BB[0], AA[0]);
      |                            ^~
      |                            A
icc.cpp: In function 'void solve()':
icc.cpp:99:5: error: 'match' was not declared in this scope; did you mean 'rpmatch'?
   99 |     match(temp);
      |     ^~~~~
      |     rpmatch