제출 #632312

#제출 시각아이디문제언어결과실행 시간메모리
632312Cyber_WolfICC (CEOI16_icc)C++14
컴파일 에러
0 ms0 KiB
//CEOI '16 P1 //Problem: ICC //Link: https://oj.uz/problem/view/CEOI16_icc #include <bits/stdc++.h> #include "icc.h" using namespace std; #define lg long long const lg MOD = 1e9+7, N = 101, M = 1e7+1, SZ = 1e3+1; lg par[N], compSize[N]; lg getParent(lg src) { if(src == par[src]) return src; return par[src] = getParent(par[src]); } void join(lg u, lg v) { u = getParent(u), v = getParent(v); if(u == v) return; if(compSize[u] > compSize[v]) swap(u, v); par[u] = v; compSize[v] += compSize[u]; } void run(int n) { for(int i = 1; i <= n; i++) par[i] = i, compSize[i] = 1; lg x = n-1; while(x--) { for(int i = 1; i <= n; i++) { vector<lg> v; for(int j = 1; j <= n; j++) if(getParent(i) != getParent(j)) v.push_back(j); int arr[v.size()]; for(int j = 0; j < v.size(); j++) arr[j] = v[j]; int h[1] = {i}; bool flag = query(1, v.size(), h, arr); if(!flag) continue; for(auto it : v[j]) { int g[] = {it}; bool cur = query(1, 1, h, g); if(cur) { join(h, g); setRoad(h, g); break; } } } } }

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

icc.cpp: In function 'void run(int)':
icc.cpp:43:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |    for(int j = 0; j < v.size(); j++) arr[j] = v[j];
      |                   ~~^~~~~~~~~~
icc.cpp:47:20: error: 'j' was not declared in this scope
   47 |    for(auto it : v[j])
      |                    ^
icc.cpp:53:11: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
   53 |      join(h, g);
      |           ^
      |           |
      |           int*
icc.cpp:22:14: note:   initializing argument 1 of 'void join(long long int, long long int)'
   22 | void join(lg u, lg v)
      |              ^
icc.cpp:53:14: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
   53 |      join(h, g);
      |              ^
      |              |
      |              int*
icc.cpp:22:20: note:   initializing argument 2 of 'void join(long long int, long long int)'
   22 | void join(lg u, lg v)
      |                    ^
icc.cpp:54:14: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   54 |      setRoad(h, g);
      |              ^
      |              |
      |              int*
In file included from icc.cpp:6:
icc.h:11:18: note:   initializing argument 1 of 'void setRoad(int, int)'
   11 | void setRoad(int a, int b);
      |              ~~~~^
icc.cpp:54:17: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   54 |      setRoad(h, g);
      |                 ^
      |                 |
      |                 int*
In file included from icc.cpp:6:
icc.h:11:25: note:   initializing argument 2 of 'void setRoad(int, int)'
   11 | void setRoad(int a, int b);
      |                     ~~~~^