답안 #526729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526729 2022-02-16T03:13:15 Z MEGalodon Palembang Bridges (APIO15_bridge) C++14
22 / 100
42 ms 4332 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int K, people;
    cin>>K>>people;
    vector<ll> values;
    ll output = 0;
    while( people-- ){
        char p, q;
        ll s, t;
        cin>>p>>s>>q>>t;
        if( p != q ){ values.push_back(s); values.push_back(t); }
        else{ output += abs(s-t); }
    }
    sort(values.begin(), values.end());
    if( !values.empty() ){
        ll m = values[(((int)values.size()+1)/2)-1];
        for( ll x : values ) output += abs(x-m);
    }
    output += (ll)values.size()/2;
    cout<<output<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 220 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 312 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 20 ms 3188 KB Output is correct
13 Correct 42 ms 4268 KB Output is correct
14 Correct 31 ms 3604 KB Output is correct
15 Correct 22 ms 2716 KB Output is correct
16 Correct 39 ms 3696 KB Output is correct
17 Correct 33 ms 4228 KB Output is correct
18 Correct 37 ms 3944 KB Output is correct
19 Correct 38 ms 4332 KB Output is correct
20 Correct 29 ms 3804 KB Output is correct
21 Correct 35 ms 4068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -