제출 #472306

#제출 시각아이디문제언어결과실행 시간메모리
472306SaraMostafaTeoretičar (COCI18_teoreticar)C++14
0 / 130
3077 ms120388 KiB
#include <bits/stdc++.h> #include<unordered_map> using namespace std; #define ll long long #define endl "\n" #define Sara ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); const long long mod=998244353; const double PI=acos(-1); int main() { //freopen("input.in","r",stdin); Sara ll l,r,e; cin>>l>>r>>e; map<ll,vector<ll>>mp; map<pair<ll,ll>,ll>ed; map<ll,ll>col; for(int i=0; i<e; i++) { ll a,b; cin>>a>>b; b*=-1; mp[a].push_back(b); mp[b].push_back(a); ed[ {a,b}]=i; ed[ {b,a}]=i; } ll c=0,mx=0; for(auto i:mp) { c=1; for(auto j:i.second) { if(col[ed[{i.first,j}]]) continue; col[ed[ {i.first,j}]]=c; mx=max(mx,c); c++; } } cout<<mx<<endl; for(int i=0;i<e;i++) cout<<col[i]<<endl; return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...