답안 #682183

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
682183 2023-01-16T04:06:13 Z vjudge1 Road Construction (JOI21_road_construction) C++17
5 / 100
1997 ms 2097152 KB
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

#define int long long
#define ll long long
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define freopen(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

const int N = 250000 + 5;
const int M = 1e3 + 5;
const ll mod = 1e9 + 7;
const ll inf = 1e17;

int n, k, x[N], y[N];
vector<int> v;

int dist(int i, int j){
    return abs(x[i] - x[j]) + abs(y[i] - y[j]);
}

void solve(){
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> x[i] >> y[i];
        for(int j = 1; j < i; j++){
            v.pb(dist(i, j));
        }
    }
    sort(all(v));
    for(int i = 0; i < k; i++){
        cout << v[i] << '\n';
    }
}

main() {
    fast
    int tt = 1;
    // cin >> tt;
    while(tt--){
        solve();
    }
}

Compilation message

road_construction.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization("O3")
      | 
road_construction.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    4 | #pragma GCC optimization("unroll-loops")
      | 
road_construction.cpp:5: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    5 | #pragma comment(linker, "/stack:200000000")
      | 
road_construction.cpp:46:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   46 | main() {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 6968 KB Output is correct
2 Correct 73 ms 6988 KB Output is correct
3 Correct 40 ms 5044 KB Output is correct
4 Correct 37 ms 5156 KB Output is correct
5 Correct 57 ms 5824 KB Output is correct
6 Correct 22 ms 4556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1997 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1785 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1785 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 6968 KB Output is correct
2 Correct 73 ms 6988 KB Output is correct
3 Correct 40 ms 5044 KB Output is correct
4 Correct 37 ms 5156 KB Output is correct
5 Correct 57 ms 5824 KB Output is correct
6 Correct 22 ms 4556 KB Output is correct
7 Runtime error 1811 ms 2097152 KB Execution killed with signal 9
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 6968 KB Output is correct
2 Correct 73 ms 6988 KB Output is correct
3 Correct 40 ms 5044 KB Output is correct
4 Correct 37 ms 5156 KB Output is correct
5 Correct 57 ms 5824 KB Output is correct
6 Correct 22 ms 4556 KB Output is correct
7 Runtime error 1997 ms 2097152 KB Execution killed with signal 9
8 Halted 0 ms 0 KB -