Submission #120995

#TimeUsernameProblemLanguageResultExecution timeMemory
120995ioilolcom자리 배치 (IOI18_seats)C++14
Compilation error
0 ms0 KiB
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> r;
std::vector<int> c;
int mr=1e9;
int mc=1e9;
int mmc,mmr;
set<pair<int,int> > st;
bool check(){
	for(int i=mr; i<=mmr; i++) {
		for(int j=mc; j<=mmc; j++) {
			if(!st.count({i,j})) {
				return false;
			}
		}
	}
	return true;
}
int h,w;
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
	r=R;
	c=C;
	h=H;
	w=W;
}

int swap_seats(int a, int b) {
	mr=1e9; mc=1e9;
	mmc=0; mmr=0;
	st.clear();
	swap(r[a],r[b]);
	swap(c[a],c[b] );
	int cnt=0;
	for(int i=0; i<=h*w-1; i++) {
		mr=min(mr,r[i]);
		mmr=max(mmr,r[i]);
		mc=min(mc,c[i]);
		mmc=max(mmc,c[i]);
		st.insert({r[i],c[i]});
		if(check(i)) {
			cnt++;
		}
	}
	return cnt;
}

Compilation message (stderr)

seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:41:13: error: too many arguments to function 'bool check()'
   if(check(i)) {
             ^
seats.cpp:10:6: note: declared here
 bool check(){
      ^~~~~