제출 #67044

#제출 시각아이디문제언어결과실행 시간메모리
67044nvmdava팀들 (IOI15_teams)C++17
컴파일 에러
0 ms0 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
struct unit{
	int l, r;
};
vector<unit> v;
void init(int N, int A[], int B[]) {
	sort(A, A + N);
	sort(B, B + N);
	unit t;
	
	for(i = 0; i < N; i++){
		t.l = A[i];
		t.r = B[i];
		v.push_back(t);
	}
	
}

int can(int M, int K[]) {
	int t = K[0], i = 0;
	for(auto x : v){
		if(K[i] < x.l){
			return 0;
		}
		if(K[i] <= x.r){
			t--;
			if(t == 0){
				i++;
				if(i == M){
					return 1;
				}
				t = K[i];
			}
		}
	}
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:13:6: error: 'i' was not declared in this scope
  for(i = 0; i < N; i++){
      ^