답안 #878829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878829 2023-11-25T09:48:41 Z niter Coin Collecting (JOI19_ho_t4) C++14
0 / 100
990 ms 420 KB
#include <bits/stdc++.h>
#define pb push_back
#define ins isnert
#define pii pair<int,int>
#define ff first
#define ss second
#define loop(i,a,b) for(int i = (a); i < (b); i ++)
#define op(x) cerr << #x << " = " << x << endl;
#define opa(x) cerr << #x << " = " << x << ", ";
#define ops(x) cerr << x;
#define spac cerr << ' ';
#define entr cerr << endl;
#define STL(x) cerr << #x << " : "; for(auto &qwe:x) cerr << qwe << ' '; cerr << endl;
#define ARR(x, nnn) cerr << #x << " : "; loop(qwe,0,nnn) cerr << x[qwe] << ' '; cerr << endl;
#define BAE(x) (x).begin(), (x).end()
#pragma GCC optimize("O3")
using namespace std;
typedef long long ll;
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());

pii a[30], b[30];
int main(){
    int n, m;
    cin >> n;
    m = n << 1;
    loop(i,0,m) cin >> a[i].ff >> a[i].ss;
    loop(i,0,n){
        b[i] = {i + 1, 1};
        b[i + n] = {i + 1, 2};
    }
    sort(b, b + m);
    long long ans = (ll)(1e18), tmp;
    do{
        shuffle(b, b + m, RNG);
        tmp = 0;
        loop(i,0,m){
            tmp += abs(a[i].ff - b[i].ff) + abs(a[i].ss - b[i].ss);
        }
        ans = min(ans, tmp);
    }while((long double)clock() / CLOCKS_PER_SEC <= 0.99);
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 990 ms 416 KB Output is correct
2 Correct 990 ms 412 KB Output is correct
3 Correct 990 ms 420 KB Output is correct
4 Incorrect 990 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 990 ms 416 KB Output is correct
2 Correct 990 ms 412 KB Output is correct
3 Correct 990 ms 420 KB Output is correct
4 Incorrect 990 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 990 ms 416 KB Output is correct
2 Correct 990 ms 412 KB Output is correct
3 Correct 990 ms 420 KB Output is correct
4 Incorrect 990 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -