답안 #190357

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
190357 2020-01-14T07:43:45 Z mrtsima22 Lightning Rod (NOI18_lightningrod) C++17
80 / 100
2000 ms 113584 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define two pair<int,int>
#define pb push_back
#define f first
#define s second
#define sz(container) (int)(container.size())

inline int bin(){
	int x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
int n,a,b,x,y;
bool ok;
two c;
stack<two>st;
int main(){
n=bin();
while(n--){
	x=bin();
	y=bin();
	ok=1;
	while(sz(st)){
		c=st.top();
		a=c.f;
		b=c.s;
		if(x-a<=b-y){
			ok=0;
			break;
		}
		if(x-a<=y-b){
			st.pop();
		}else{
			break;
		}
	}
	if(ok){
		st.push({x,y});
	}
}
cout<<sz(st)<<endl;

	// you should actually read the stuff at the bottom
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?), slow multiset operations
	* do smth instead of nothing and stay organized
	* unordered_map, hash_map, scanf, calculate answer instead of ans*K
*/
/*


                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/


# 결과 실행 시간 메모리 Grader output
1 Correct 1708 ms 111956 KB Output is correct
2 Correct 1702 ms 113584 KB Output is correct
3 Correct 1645 ms 111932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 400 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 400 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 400 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 432 KB Output is correct
12 Correct 3 ms 372 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 400 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 432 KB Output is correct
12 Correct 3 ms 372 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 53 ms 3936 KB Output is correct
15 Correct 53 ms 3680 KB Output is correct
16 Correct 45 ms 3704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1494 ms 81588 KB Output is correct
2 Correct 1496 ms 80996 KB Output is correct
3 Correct 1445 ms 79016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1708 ms 111956 KB Output is correct
2 Correct 1702 ms 113584 KB Output is correct
3 Correct 1645 ms 111932 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 400 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 1 ms 396 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 3 ms 432 KB Output is correct
15 Correct 3 ms 372 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 53 ms 3936 KB Output is correct
18 Correct 53 ms 3680 KB Output is correct
19 Correct 45 ms 3704 KB Output is correct
20 Correct 1494 ms 81588 KB Output is correct
21 Correct 1496 ms 80996 KB Output is correct
22 Correct 1445 ms 79016 KB Output is correct
23 Execution timed out 2094 ms 51208 KB Time limit exceeded
24 Halted 0 ms 0 KB -