# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70592 | octopuses | Alternating Current (BOI18_alternating) | C++17 | 95 ms | 18712 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.
//Giorgi Kldiashvili
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 100020;
vector < pair < int, int > > A[N];
int answer[N], S[2];
int n, m;
int main()
{
scanf("%d %d", &n, &m);
for(int i = 1; i <= m; ++ i)
{
int x, y;
scanf("%d %d", &x, &y);
A[x].push_back(make_pair(y, i));
}
S[0] = S[1] = 0;
for(int i = 1; i <= n; ++ i)
{
for(int j = 0; j < A[i].size(); ++ j)
{
int c = (S[0] < S[1])?0:1;
S[c] = max(S[c], A[i][j].first);
answer[A[i][j].second] = c;
}
if(S[0] < i || S[1] < i)
return printf("impossible"), 0;
}
for(int i = 1; i <= m; ++ i)
printf("%d", answer[i]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |