Submission #907379

# Submission time Handle Problem Language Result Execution time Memory
907379 2024-01-15T12:43:40 Z lighton Road Construction (JOI21_road_construction) C++17
0 / 100
78 ms 17956 KB
#include <bits/stdc++.h>
#define forf(i,a,b) for(int i = a; i<=b; i++)
#define all(v) v.begin(),v.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
int N,K;
ll X[1000001],Y[1000001];
pair<ll,ll> Xind[1000001] , Yind[100001];
set<pair<ll,ll> > S;
ll inf = 1e18;

int main(){
    scanf("%d %d" , &N,&K);
    forf(i,1,N) scanf("%lld %lld" , &X[i] , &Y[i]);
    forf(i,1,N){
        ll x = X[i], y = Y[i];
        X[i] = x+y;
        Y[i] = x-y;
        Xind[i] = {X[i],i};
        Yind[i] = {Y[i],i};
    }
    sort(Xind+1,Xind+N+1); sort(Yind+1,Yind+N+1);
    ll ans = inf;
    forf(i,2,N){
        ans = min(ans,Xind[i].fi-Xind[i-1].fi);
        ans = min(ans,Yind[i].fi-Yind[i-1].fi);
    }
    printf("%lld" , ans);
}

Compilation message

road_construction.cpp: In function 'int main()':
road_construction.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%d %d" , &N,&K);
      |     ~~~~~^~~~~~~~~~~~~~~~~
road_construction.cpp:16:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     forf(i,1,N) scanf("%lld %lld" , &X[i] , &Y[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 17956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 17580 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 17580 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6492 KB Output isn't correct
2 Halted 0 ms 0 KB -