답안 #426526

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
426526 2021-06-14T06:01:58 Z Amylopectin Lightning Rod (NOI18_lightningrod) C++14
66 / 100
2000 ms 98896 KB
    //#include <iostream>
    //#include <stdio.h>
    //#include <stdlib.h>
    #include <bits/stdc++.h>
    using namespace std;
    const int mxn = 2e7 + 10;
    struct we
    {
        int xx,yy;
    };
    struct we a[mxn] = {};
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int i,j,n,m,ru = -1,cx,cy;
        cin >> n;
    //    scanf("%d",&n);
        for(i=0; i<n; i++)
        {
            cin >> cx >> cy;
    //        scanf("%d %d",&cx,&cy);
            while(ru >= 0 && cx - a[ru].xx <= cy - a[ru].yy)
            {
                ru --;
            }
            if(ru == -1 || cx - a[ru].xx > a[ru].yy - cy)
            {
                ru ++;
                a[ru] = {cx,cy};
            }
        }
        cout << ru + 1 << "\n";
    //    printf("%d\n",ru + 1);
        return 0;
    }

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:17:15: warning: unused variable 'j' [-Wunused-variable]
   17 |         int i,j,n,m,ru = -1,cx,cy;
      |               ^
lightningrod.cpp:17:19: warning: unused variable 'm' [-Wunused-variable]
   17 |         int i,j,n,m,ru = -1,cx,cy;
      |                   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1975 ms 77792 KB Output is correct
2 Correct 1912 ms 77684 KB Output is correct
3 Execution timed out 2043 ms 98896 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 260 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 260 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 260 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 260 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 46 ms 2348 KB Output is correct
15 Correct 53 ms 2352 KB Output is correct
16 Correct 95 ms 2632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2029 ms 49980 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1975 ms 77792 KB Output is correct
2 Correct 1912 ms 77684 KB Output is correct
3 Execution timed out 2043 ms 98896 KB Time limit exceeded