# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
107000 | 2019-04-21T12:31:36 Z | piri007 | 곡선 자르기 (KOI17_cut) | C++14 | 4 ms | 400 KB |
#include <bits/stdc++.h> using namespace std; stack <int> s; //작동시 현재 갇혀있는가 안 갇혀있는가 priority_queue<pair<int, int>> q;//짝궁정하기 int main() { int ban, ban2 = 0; //처음 y가 양수일 때의 반례를 해결해보자 int fx, fy; int n, x, y = 0, num[] = {0, 0}; scanf("%d", &n); for (int i = 0; i < n; i++) { // printf("%d", i); int a, b; if (ban2 && i + 1 == n) a = fx, b = fy; else scanf("%d %d", &a, &b); if (!y && b > 0) num[1] = 1, ban2 = 1, fx = a, fy = b, n++; if (y && b*y < 0) { q.emplace(-a, num[0]); ban = -a; if (!num[1]) num[1]++; else num[0]++, num[1] = 0; } x = a, y = b; } int res1 = 0, res2 = 0, before = -1; while (!q.empty()) { int mat = q.top().second; //0부터 시작 if (ban2 && q.top().first == ban) mat = 0; q.pop(); // printf("mate : %d, size : %d\n", mat, s.size()); if (s.empty() || s.top() != mat) s.push(mat); else if (!s.empty()) s.pop(); //갇힘? 풀림? if (s.empty()) res1++; //이 단계에서 풀렸으면 가장 밖 if (mat == before) res2++; //()모양일때 가장 안 before = mat; } printf("%d %d", res1, res2); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 256 KB | Output is correct |
5 | Correct | 3 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 400 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 4 ms | 356 KB | Output is correct |
15 | Incorrect | 3 ms | 256 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 256 KB | Output is correct |
5 | Correct | 3 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 400 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 4 ms | 356 KB | Output is correct |
15 | Incorrect | 3 ms | 256 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 256 KB | Output is correct |
5 | Correct | 3 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 400 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 4 ms | 356 KB | Output is correct |
15 | Incorrect | 3 ms | 256 KB | Output isn't correct |