이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
*/
컴파일 시 표준 에러 (stderr) 메시지
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |