Submission #200035

# Submission time Handle Problem Language Result Execution time Memory
200035 2020-02-05T03:37:09 Z wilwxk Lightning Rod (NOI18_lightningrod) C++14
66 / 100
2000 ms 164624 KB
#include <bits/stdc++.h>
using namespace std;

set<pair<int, int> > s;
int n;

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) {
		int a, b; scanf("%d %d", &a, &b);
		int x = a+b; int y = b-a;
		
		auto sit = s.lower_bound({x, y});
		if(sit != s.end() && sit->second >= y) continue;
		if(sit != s.end() && make_pair(x, y) > (*sit)) sit = prev(s.erase(sit));
		while(sit != s.begin() && prev(sit)->second <= y) sit = s.erase(prev(sit));
		s.insert({x, y});
	}

	printf("%d\n", int(s.size()));
}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
lightningrod.cpp:10:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d %d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 164624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 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 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 376 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 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 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 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 85 ms 3960 KB Output is correct
15 Correct 78 ms 3832 KB Output is correct
16 Correct 108 ms 6904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2009 ms 127668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 164624 KB Time limit exceeded
2 Halted 0 ms 0 KB -