답안 #426259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
426259 2021-06-13T16:09:08 Z Amylopectin Lightning Rod (NOI18_lightningrod) C++14
0 / 100
2000 ms 111424 KB
#include <iostream>
#include <stdio.h>
using namespace std;
const int mxn = 1e7 + 10;
struct we
{
    int xx,yy;
};
struct we a[mxn] = {};
int main()
{
    int i,j,n,m,ru = -1,cx,cy;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d %d",&cx,&cy);
        while(ru >= 0 && cx - a[ru].xx <= cy - a[ru].yy)
        {
            ru --;
        }
        if(cx - a[ru].xx > a[ru].yy - cy)
        {
            ru ++;
            a[ru] = {cx,cy};
        }
    }
    printf("%d\n",ru + 1);
    return 0;
}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:12:11: warning: unused variable 'j' [-Wunused-variable]
   12 |     int i,j,n,m,ru = -1,cx,cy;
      |           ^
lightningrod.cpp:12:15: warning: unused variable 'm' [-Wunused-variable]
   12 |     int i,j,n,m,ru = -1,cx,cy;
      |               ^
lightningrod.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
lightningrod.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d %d",&cx,&cy);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2037 ms 111424 KB Time limit exceeded
2 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 256 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 256 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 256 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 256 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2008 ms 78424 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2037 ms 111424 KB Time limit exceeded
2 Halted 0 ms 0 KB -