답안 #864442

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864442 2023-10-23T01:01:00 Z suiyeet Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
474 ms 26196 KB
#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
void debug_out() {cerr<<endl;}
template <typename Head, typename... Tail>
void debug_out(Head _H, Tail... _T) {cerr<<" "<<to_string(_H);debug_out(_T...);}
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
const int MAXN = -1;
const int inf=1000000500ll;
const long long oo =1000000000000000500ll;
const int MOD = (int)1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int> pi; 
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    multiset<pi> in, out;
    int n=s.size();
    for(int i=0;i<n;i++){
        in.insert({s[i],t[i]});
        out.insert({t[i],s[i]});
    }
    while((int)out.size() > 1){
        int mn=out.begin()->first;
        pi cur=*out.begin();
        out.erase(out.begin());
        in.erase(in.find({cur.second,cur.first}));
        auto iter=in.lower_bound({mn,0});
        if(iter == in.end()){
            return 1;
        }
        pi nxt=*iter;
        in.erase(iter);
        out.erase(out.find({nxt.second,nxt.first}));

        pi newtrack={cur.second,nxt.second};

        in.insert({newtrack.first,newtrack.second});
        out.insert({newtrack.second,newtrack.first});
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB n = 2
2 Correct 1 ms 348 KB n = 2
3 Correct 1 ms 348 KB n = 2
4 Correct 0 ms 348 KB n = 2
5 Correct 0 ms 348 KB n = 2
6 Incorrect 0 ms 348 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB n = 2
2 Correct 1 ms 348 KB n = 2
3 Correct 1 ms 348 KB n = 2
4 Correct 0 ms 348 KB n = 2
5 Correct 0 ms 348 KB n = 2
6 Incorrect 0 ms 348 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 474 ms 22344 KB n = 199999
2 Correct 414 ms 26196 KB n = 199991
3 Correct 299 ms 26196 KB n = 199993
4 Correct 257 ms 19720 KB n = 152076
5 Correct 133 ms 12372 KB n = 93249
6 Incorrect 274 ms 25292 KB answer is not correct: 1 instead of 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB n = 2
2 Correct 1 ms 348 KB n = 2
3 Correct 1 ms 348 KB n = 2
4 Correct 0 ms 348 KB n = 2
5 Correct 0 ms 348 KB n = 2
6 Incorrect 0 ms 348 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -