Submission #426281

# Submission time Handle Problem Language Result Execution time Memory
426281 2021-06-13T16:38:18 Z Amylopectin Lightning Rod (NOI18_lightningrod) C++14
80 / 100
2000 ms 156624 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e7 + 10;
struct we
{
    int xx,yy;
};
struct we a[mxn] = {};
int main()
{
    ios_base::sync_with_stdio(false);
    cin.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 << endl;
//    printf("%d\n",ru + 1);
    return 0;
}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:16:11: warning: unused variable 'j' [-Wunused-variable]
   16 |     int i,j,n,m,ru = -1,cx,cy;
      |           ^
lightningrod.cpp:16:15: warning: unused variable 'm' [-Wunused-variable]
   16 |     int i,j,n,m,ru = -1,cx,cy;
      |               ^
# Verdict Execution time Memory Grader output
1 Correct 1866 ms 76744 KB Output is correct
2 Correct 1942 ms 156624 KB Output is correct
3 Correct 1860 ms 152488 KB Output is correct
# Verdict Execution time Memory 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 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory 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 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory 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 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 320 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 324 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory 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 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 320 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 324 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 48 ms 728 KB Output is correct
15 Correct 47 ms 820 KB Output is correct
16 Correct 43 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1908 ms 49436 KB Output is correct
2 Correct 1964 ms 80668 KB Output is correct
3 Correct 1911 ms 79020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1866 ms 76744 KB Output is correct
2 Correct 1942 ms 156624 KB Output is correct
3 Correct 1860 ms 152488 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 204 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 320 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 48 ms 728 KB Output is correct
18 Correct 47 ms 820 KB Output is correct
19 Correct 43 ms 1360 KB Output is correct
20 Correct 1908 ms 49436 KB Output is correct
21 Correct 1964 ms 80668 KB Output is correct
22 Correct 1911 ms 79020 KB Output is correct
23 Execution timed out 2081 ms 54088 KB Time limit exceeded
24 Halted 0 ms 0 KB -