답안 #426512

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
426512 2021-06-14T05:53:54 Z Amylopectin Lightning Rod (NOI18_lightningrod) C++14
10 / 100
2000 ms 101860 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;
//        if(ru == -1)
//        {
//            ru ++;
//            a[ru] = {cx,cy};
//            continue;
//        }
//        scanf("%d %d",&cx,&cy);
        if(cx - a[ru].xx <= a[ru].yy - cy)
        {
//            ru ++;
//            a[ru] = {cx,cy};
            continue;
        }
        while(ru >= 0 && cx - a[ru].xx <= cy - a[ru].yy)
        {
            ru --;
        }
//        if(ru == -1)
//        {
            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:11: warning: unused variable 'j' [-Wunused-variable]
   17 |     int i,j,n,m,ru = -1,cx,cy;
      |           ^
lightningrod.cpp:17:15: warning: unused variable 'm' [-Wunused-variable]
   17 |     int i,j,n,m,ru = -1,cx,cy;
      |               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1881 ms 88472 KB Output is correct
2 Execution timed out 2008 ms 83476 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1916 ms 68580 KB Output is correct
2 Correct 1932 ms 101860 KB Output is correct
3 Correct 1958 ms 99524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1881 ms 88472 KB Output is correct
2 Execution timed out 2008 ms 83476 KB Time limit exceeded
3 Halted 0 ms 0 KB -