답안 #70592

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70592 2018-08-23T07:03:53 Z octopuses Alternating Current (BOI18_alternating) C++17
19 / 100
95 ms 18712 KB
//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

alternating.cpp: In function 'int main()':
alternating.cpp:27:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j = 0; j < A[i].size(); ++ j)
                    ~~^~~~~~~~~~~~~
alternating.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &n, &m);
   ~~~~~^~~~~~~~~~~~~~~~~
alternating.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &x, &y);
     ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 5 ms 2792 KB Output is correct
3 Incorrect 5 ms 2792 KB 'impossible' claimed, but there is a solution
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 5 ms 2792 KB Output is correct
3 Incorrect 5 ms 2792 KB 'impossible' claimed, but there is a solution
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 5 ms 2792 KB Output is correct
3 Incorrect 5 ms 2792 KB 'impossible' claimed, but there is a solution
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 5164 KB Output is correct
2 Correct 4 ms 5164 KB Output is correct
3 Correct 25 ms 5880 KB Output is correct
4 Correct 29 ms 6628 KB Output is correct
5 Correct 79 ms 8816 KB Output is correct
6 Correct 88 ms 9912 KB Output is correct
7 Correct 78 ms 11312 KB Output is correct
8 Correct 7 ms 11312 KB Output is correct
9 Correct 6 ms 11312 KB Output is correct
10 Correct 60 ms 12416 KB Output is correct
11 Correct 58 ms 12972 KB Output is correct
12 Correct 79 ms 14808 KB Output is correct
13 Correct 6 ms 14808 KB Output is correct
14 Correct 5 ms 14808 KB Output is correct
15 Correct 95 ms 15176 KB Output is correct
16 Correct 27 ms 15176 KB Output is correct
17 Correct 82 ms 16924 KB Output is correct
18 Correct 55 ms 17232 KB Output is correct
19 Correct 10 ms 17232 KB Output is correct
20 Correct 49 ms 18712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 5 ms 2792 KB Output is correct
3 Incorrect 5 ms 2792 KB 'impossible' claimed, but there is a solution
4 Halted 0 ms 0 KB -