제출 #318354

#제출 시각아이디문제언어결과실행 시간메모리
318354nekiICC (CEOI16_icc)C++14
100 / 100
144 ms740 KiB
#include <bits/stdc++.h> #include "icc.h" #define fore(i, a) for(auto&& i:a) #define fi first #define se second #define ps(a) push_back(a) #define pb(a) pop_back(a) #define sc scanf #define vc vector #define pa pair<ll, ll> #define ll int #define loop(i, a, b) for(ll i=a;i<b;i++) #define pool(i, a, b) for(ll i=a-1;i>=b;i--) #define lb lower_bound #define ub upper_bound #define all(a) a.begin(), a.end() #define llmax LLONG_MAX/2 #define llmin -LLONG_MAX/2 using namespace std; #define mn 200100 #define pa pair<ll, ll> #define ld long double vc<vc<ll>> dsu; ll que(ll sa, ll sb, vc<ll> a, vc<ll> b){ ll qa[sa], qb[sb]; loop(i, 0, sa) qa[i]=a[i]; loop(i, 0, sb) qb[i]=b[i]; return query(sa, sb, qa, qb); } void run(int n){ loop(i, 1, n+1) dsu.ps(vc<ll> {i}); loop(cnt, 0, n-1){ vc<pa> ints={make_pair(0, dsu.size())}; vc<ll> a[2]; do{ a[0].clear(), a[1].clear(); vc<pa> ne; fore(v, ints){ if(v.se-v.fi>1)ne.ps(make_pair(v.fi, (v.fi+v.se)/2)), ne.ps(make_pair((v.fi+v.se)/2, v.se)); else ne.ps(v); } ints=ne; bool br=0; fore(v, ints){ loop(j, v.fi, v.se) a[br].insert(a[br].end(), all(dsu[j])); br=!br; } }while(!que(a[0].size(), a[1].size(), a[0], a[1])); while(a[0].size()>1){ vc<ll> b[2]; loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]); if(que(a[1].size(), b[0].size(), a[1], b[0])) a[0]=b[0]; else a[0]=b[1]; } swap(a[0], a[1]); while(a[0].size()>1){ vc<ll> b[2]; loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]); if(que(a[1].size(), b[0].size(), a[1], b[0])) a[0]=b[0]; else a[0]=b[1]; } ll aa=a[0][0], ab=a[1][0]; ll da, db; loop(j, 0, dsu.size()){ fore(v, dsu[j]) if(v==aa)da=j; fore(v, dsu[j]) if(v==ab)db=j; } vc<ll> save=dsu[db]; dsu[da].insert(dsu[da].end(), all(save)); dsu.erase(dsu.begin()+db); setRoad(aa, ab); } }

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

icc.cpp: In function 'void run(int)':
icc.cpp:13:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | #define loop(i, a, b) for(ll i=a;i<b;i++)
......
   57 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |                  ~~~~~~~~~~~~~~~~~ 
icc.cpp:57:13: note: in expansion of macro 'loop'
   57 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |             ^~~~
icc.cpp:57:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |                                       ~^~~~~~~~~~~~~~
icc.cpp:13:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | #define loop(i, a, b) for(ll i=a;i<b;i++)
......
   64 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |                  ~~~~~~~~~~~~~~~~~ 
icc.cpp:64:13: note: in expansion of macro 'loop'
   64 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |             ^~~~
icc.cpp:64:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |                                       ~^~~~~~~~~~~~~~
icc.cpp:13:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | #define loop(i, a, b) for(ll i=a;i<b;i++)
......
   72 |         loop(j, 0, dsu.size()){
      |              ~~~~~~~~~~~~~~~~      
icc.cpp:72:9: note: in expansion of macro 'loop'
   72 |         loop(j, 0, dsu.size()){
      |         ^~~~
icc.cpp:77:27: warning: 'db' may be used uninitialized in this function [-Wmaybe-uninitialized]
   77 |         vc<ll> save=dsu[db];
      |                           ^
icc.cpp:78:15: warning: 'da' may be used uninitialized in this function [-Wmaybe-uninitialized]
   78 |         dsu[da].insert(dsu[da].end(), all(save));
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...