답안 #137668

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137668 2019-07-28T08:25:20 Z hamzqq9 Lightning Rod (NOI18_lightningrod) C++14
컴파일 오류
0 ms 0 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 readInt () {
	bool minus = false;
	int result = 0;
	char ch;
	ch = getchar();
	while (true) {
		if (ch == '-') break;
		if (ch >= '0' && ch <= '9') break;
		ch = getchar();
	}
	if (ch == '-') minus = true; else result = ch-'0';
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result*10 + (ch - '0');
	}
	if (minus)
		return -result;
	else
		return result;
}
int main() {

	int n;

	//scanf("%d",&n);

	readInt(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);

		readInt(a[i].st);
		readInt(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:45:11: error: too many arguments to function 'int readInt()'
  readInt(n);
           ^
lightningrod.cpp:18:5: note: declared here
 int readInt () {
     ^~~~~~~
lightningrod.cpp:55:18: error: too many arguments to function 'int readInt()'
   readInt(a[i].st);
                  ^
lightningrod.cpp:18:5: note: declared here
 int readInt () {
     ^~~~~~~
lightningrod.cpp:56:18: error: too many arguments to function 'int readInt()'
   readInt(a[i].nd);
                  ^
lightningrod.cpp:18:5: note: declared here
 int readInt () {
     ^~~~~~~