| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 388745 | Alexandra | Fountain (eJOI20_fountain) | C++14 | 1581 ms | 5888 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int N, Q;
bool romper;
int resp;
int a (vector <int>& litros, int r, int& v, vector<int>& d, vector<int>& c) {
	if (romper==true) {
		return resp;
	}
	for (int k=r; k<=N; k++) {
		if (romper==true) {
			if (resp==r) {
				resp = 0;
			}
			return resp;
			break;
		}
		else {
			if (litros[k]>c[k]) {
				if (k==N-1) {
					romper=true;
					return 0;
					break;
				}
				for (int l=k+1; l<=N; l++) {
					if (l==N) {
						break;
						return 0;
					}
					else if (d[l]>d[k]) {
						v -= c[k];
						litros[l] = v;
						k = a (litros, l, v, d, c);
						break;
					}
				}
			}
			else {
				romper=true;
				resp = k+1;
				if (resp==r) {
					resp = 0;
				}
				return resp;
				break;
			}
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> N >> Q;
	vector<int> d (N);
	vector<int> c (N);
	cin >> d[0] >> c[0];
    for(int i=1; i<N; i++){
      cin >> d[i] >> c[i];
    }
    for (int j=0; j<Q; j++) {
		int r, v;
		cin >> r >> v;
		vector <int> litros (N, 0);
		litros[r-1]=v;
		romper = false;
		cout << a (litros, r-1, v, d, c) << endl;
	}
	return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
