이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(0),cin.tie(0);
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))
#define gg exit(0);
const int N=300010;
int n,k,q;
int x[N],t[N],a[N],b[N];
int l[N],y[N];
main(){
#define task "1"
if(fopen(task".inp","r")){
freopen(task".inp","r",stdin);
//freopen(task".out","w",stdout);
}
n=in,k=in,q=in;
forinc(i,1,n){
x[i]=in, t[i]=in, a[i]=in, b[i]=in;
}
if(n<=400 && q<=400){
forinc(i,1,q){
l[i]=in, y[i]=in;
vector<int> val(k,INT_MAX);
forinc(j,1,n){
if(a[j]<=y[i] && y[i]<=b[j])
val[t[j]-1]=min(val[t[j]-1],abs(l[i]-x[j]));
}
int ret=*max_element(all(val));
cout<<(ret<INT_MAX ? ret : -1)<<"\n";
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
new_home.cpp:28:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
new_home.cpp: In function 'int main()':
new_home.cpp:31:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
freopen(task".inp","r",stdin);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |