제출 #1224861

#제출 시각아이디문제언어결과실행 시간메모리
1224861boclobanchatSaveit (IOI10_saveit)C++20
컴파일 에러
0 ms0 KiB
#include"grader.h" #include"encoder.h" #include<bits/stdc++.h> using namespace std; const int MAXN=1024; const int INF=1e9; int dp[MAXN][MAXN],trace[MAXN][MAXN]; vector<int> ds[MAXN],vi[MAXN]; bool comp(pair<int,long long> a,pair<int,long long> b) { return __builtin_popcountll(a.second)>__builtin_popcountll(b.second); } void encode(int nv,int nh,int ne,int *v1,int *v2) { for(int i=0;i<ne;i++) ds[v1[i]].push_back(v2[i]),ds[v2[i]].push_back(v1[i]); for(int i=0;i<nh;i++) { queue<int> Q; for(int j=0;j<nv;j++) dp[i][j]=INF; dp[i][i]=0,Q.push(i); while(!Q.empty()) { int a=Q.front(); Q.pop(); for(auto v:ds[a]) if(dp[i][v]==INF) dp[i][v]=dp[i][a]+1,Q.push(v); } } for(int i=0;i<nv;i++) { vector< pair<int,long long> > vv; for(auto v:ds[a]) { long long mask=0; for(int j=0;j<nh;j++) mask|=(1LL<<j)*(dp[j][i]==dp[j][v]+1); vv.push_back({v,mask}); } sort(vv.begin(),vv.end(),comp); long long mask=0; for(auto v:vv) { if((mask&v.second)==v.second) continue; mask|=v.second,vi[i].push_back(v.first); if(mask==(1LL<<(nh+1))-1) break; } } for(int i=0;i<nv;i++) { sort(vi[i].begin(),vi[i].end()); vi[i].erase(unique(vi[i].begin(),vi[i].end()),vi[i].end()); int sz=vi[i].size(); for(int j=5;j+1;j--) encode_bit((sz>>j)%2); for(auto v:vi[i]) for(int j=9;j+1;j--) encode_bit((v>>j)%2); } }
#include"grader.h" #include"decoder.h" #include<bits/stdc++.h> using namespace std; const int MAXN=1024; const int INF=1e9; int dp[MAXN][MAXN],trace[MAXN][MAXN]; vector<int> ds[MAXN],vi[MAXN]; void decode(int nv,int nh) { for(int i=0;i<nv;i++) { int sz=0; for(int j=5;j+1;j--) sz=sz*2+decode_bit(); while(sz--) { int res=0; for(int j=9;j+1;j--) res=res*2+decode_bit(); ds[i].push_back(res),ds[res].push_back(i); } } for(int i=0;i<nh;i++) { queue<int> Q; for(int j=0;j<nv;j++) dp[i][j]=INF; dp[i][i]=0,Q.push(i); while(!Q.empty()) { int a=Q.front(); Q.pop(); for(auto v:ds[a]) if(dp[i][v]==INF) dp[i][v]=dp[i][a]+1,trace[i][v]=a,Q.push(v); } for(int j=0;j<nv;j++) hops(i,j,dp[i][j]); } }

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

# 1번째 컴파일 단계

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:31:31: error: 'a' was not declared in this scope
   31 |                 for(auto v:ds[a])
      |                               ^
encoder.cpp:35:37: error: no matching function for call to 'std::vector<std::pair<int, long long int> >::push_back(<brace-enclosed initializer list>)'
   35 |                         vv.push_back({v,mask});
      |                         ~~~~~~~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from encoder.cpp:3:
/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, long long int>; _Alloc = std::allocator<std::pair<int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, long long int>; _Alloc = std::allocator<std::pair<int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, long long int> >::value_type&&' {aka 'std::pair<int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~