# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136360 | khsoo01 | Queue (CEOI06_queue) | C++11 | 434 ms | 20196 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef pair<int,int> pii;
const int N = 50005, inf = 1e9+7;
map<int, int> fr, bk, s[2];
int getfr (int I) {
if(fr.find(I) == fr.end()) return I-1;
return fr[I];
}
int getbk (int I) {
if(bk.find(I) == bk.end()) return I+1;
return bk[I];
}
int main()
{
int n, q, CT = 1;
scanf("%d",&n);
while(n--) {
int A, B;
scanf("%d%d",&A,&B);
int AF = getfr(A), AB = getbk(A), BF = getfr(B);
if(A == B || AB == B) continue;
fr[AB] = AF;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |