Submission #204941

# Submission time Handle Problem Language Result Execution time Memory
204941 2020-02-27T13:54:08 Z quocnguyen1012 Lightning Rod (NOI18_lightningrod) C++14
76 / 100
711 ms 189008 KB
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 1e7+7;
pair<int, int> v[MAXN];
int n;
 
int getn() {
	char ch = getchar_unlocked();
    int ans = 0;
    while(!isdigit(ch)) {
        ch = getchar_unlocked();
    }
    while(isdigit(ch)) {
        ans = ans * 10 + ch - '0';
        ch = getchar_unlocked();
    }
    return ans;
}
 
int main() {
	n = getn();
	for(int i = 1; i <= n; i++) {
		int a = getn();
		int b = getn();
		v[i].first = a+b;
		v[i].second = b-a;
	}
	sort(v+1, v+1+n);
 
	int ans = 0; int mx = -(2e9+7);
	for(int i = n; i >= 1; i--) if(v[i].second > mx) mx = v[i].second, ans++;
 
	printf("%d\n", ans);
}
# Verdict Execution time Memory Grader output
1 Correct 699 ms 189008 KB Output is correct
2 Execution timed out 182 ms 69860 KB Time limit exceeded (wall clock)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 424 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 424 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 424 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 424 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 37 ms 5368 KB Output is correct
15 Correct 32 ms 5144 KB Output is correct
16 Correct 24 ms 4472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 711 ms 174740 KB Output is correct
2 Correct 706 ms 174752 KB Output is correct
3 Correct 708 ms 170568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 699 ms 189008 KB Output is correct
2 Execution timed out 182 ms 69860 KB Time limit exceeded (wall clock)
3 Halted 0 ms 0 KB -