Submission #137662

# Submission time Handle Problem Language Result Execution time Memory
137662 2019-07-28T08:22:01 Z hamzqq9 Lightning Rod (NOI18_lightningrod) C++14
0 / 100
2000 ms 79556 KB
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ii pair<int,int>
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define orta ((bas+son)>>1)
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define inf 2000000000
#define N 500005
#define MOD 1000000007
using namespace std;

int main() {

	int n;

	scanf("%d",&n);

	vector<ii> a(n);
	vector<bool> u(n);
	int cnt=n;

	for(int i=0;i<n;i++) {

		scanf("%d %d",&a[i].st,&a[i].nd);

	}

	return 0;

	sort(a.begin(),a.end());

	int mn=inf;

	for(int i=n-1;i>=0;i--) {

		int val=a[i].st-a[i].nd;

		if(mn<=val) {

			cnt-=!u[i];
			u[i]=1;

		}

		umin(mn,val);

	}

	for(int i=0;i<n;i++) {

		int b=i;

		while(i+1<n && a[i].st==a[i+1].st) i++;

		reverse(a.begin()+b,a.begin()+i+1);

	}

	int mx=-inf;

	for(int i=0;i<n;i++) {

		int val=a[i].st+a[i].nd;

		if(mx>=val) {

			cnt-=!u[i];
			u[i]=1;

		}

		umax(mx,val);

	}

	printf("%d",cnt);

}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
lightningrod.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&a[i].st,&a[i].nd);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 79196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2001 ms 79556 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 79196 KB Time limit exceeded
2 Halted 0 ms 0 KB -