Submission #401322

#TimeUsernameProblemLanguageResultExecution timeMemory
401322hgmhc공주님의 정원 (KOI11_flower)C++14
18 / 18
88 ms1992 KiB
#include <iostream>
#include <functional>
#include <algorithm>
#include <utility>
using namespace std;
using pi = pair<int,int>;
#define S first
#define F second
 
int main() {
    int s = 301, e = 1130;
    int n; cin >> n;
    pi flowers[n];
    for (auto& s : flowers) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        s = {100*c+d, 100*a+b};
    }
    sort(flowers, flowers+n, greater<pi>());
    int cnt = 0; bool chk = false;
    for (int i = s; i <= e; chk = false) {
        for (auto& f : flowers) {
            if (f.F <= i) {
                i = f.S;
                chk = true;
                f = {1232, 1232};
                break;
            }
        }
        if (!chk) {cout << 0; return 0;}
        ++cnt;
    }
    cout << cnt;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...