Submission #880933

# Submission time Handle Problem Language Result Execution time Memory
880933 2023-11-30T08:55:30 Z HuyQuang_re_Zero Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
718 ms 63780 KB
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define IDB pair <db,int>
#define TII pair <treap*,treap*>
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define Log(x) (31-__builtin_clz((int)x))
#define LogLL(x) (63-__builtin_clzll((ll)x))
using namespace std;
#include "railroad.h"
ll plan_roller_coaster(vector <int> s,vector <int> t)
{
    set <int> val;
    map <int,int> U,D;
    int i;
    for(i=0;i<s.size();i++)
    {
        val.insert(s[i]); val.insert(t[i]);
        if(s[i]<=t[i]) U[s[i]]++,U[t[i]]--;
        else D[t[i]]++,D[s[i]]--;
    }
    val.insert(1);
    int up=0,down=0;
    for(int x:val)
    {
        up+=U[x]; down+=D[x];
        if(up>down) return 1;
    }
    return 0;
}
/*
int main()
{
    freopen("railroad.inp","r",stdin);
    freopen("railroad.out","w",stdout);
    vector <int> s,t;
    int l,r;
    while(cin>>l>>r) s.push_back(l),t.push_back(r);
    cout<<plan_roller_coaster(s,t);
}
*/

Compilation message

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:24:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(i=0;i<s.size();i++)
      |             ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 2
2 Correct 1 ms 600 KB n = 2
3 Correct 0 ms 348 KB n = 2
4 Correct 1 ms 348 KB n = 2
5 Correct 1 ms 348 KB n = 2
6 Incorrect 1 ms 348 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 2
2 Correct 1 ms 600 KB n = 2
3 Correct 0 ms 348 KB n = 2
4 Correct 1 ms 348 KB n = 2
5 Correct 1 ms 348 KB n = 2
6 Incorrect 1 ms 348 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 718 ms 63780 KB n = 199999
2 Correct 671 ms 45176 KB n = 199991
3 Correct 600 ms 45044 KB n = 199993
4 Correct 604 ms 48348 KB n = 152076
5 Correct 314 ms 29944 KB n = 93249
6 Correct 546 ms 52312 KB n = 199910
7 Correct 558 ms 61780 KB n = 199999
8 Correct 475 ms 52680 KB n = 199997
9 Correct 606 ms 54628 KB n = 171294
10 Incorrect 477 ms 44880 KB answer is not correct: 1 instead of 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 2
2 Correct 1 ms 600 KB n = 2
3 Correct 0 ms 348 KB n = 2
4 Correct 1 ms 348 KB n = 2
5 Correct 1 ms 348 KB n = 2
6 Incorrect 1 ms 348 KB answer is not correct: 1 instead of 523688153
7 Halted 0 ms 0 KB -