Submission #472306

# Submission time Handle Problem Language Result Execution time Memory
472306 2021-09-13T11:26:39 Z SaraMostafa Teoretičar (COCI18_teoreticar) C++14
0 / 130
3077 ms 120388 KB
#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 time Memory Grader output
1 Incorrect 1 ms 316 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1764 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 1656 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2425 ms 97692 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2389 ms 97624 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3077 ms 120388 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2993 ms 111164 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2159 ms 88524 KB not colored properly
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2254 ms 87716 KB not colored properly
2 Halted 0 ms 0 KB -