답안 #774731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
774731 2023-07-06T02:21:23 Z Tony1234 전선 연결 (IOI17_wiring) C++17
13 / 100
27 ms 3800 KB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
#define vt vector
#define vi vector<int>
#define vll vector<ll>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define ub upper_bound
#define lb lower_bound


const int inf = (int)2e9, mod = (int)1e9 + 7, mx = (int)2e5 + 10;
const ll infll = (ll)7e18;

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
long long min_total_length(std::vector<int> r, std::vector<int> b){
    sort(r.begin(), r.end()); sort(b.begin(), b.end());
    ll sum = 0;
    for(int i = 0; i < min(r.size(), b.size()); i++)sum += b[i] - r[i];
    if(r.size() > b.size()){
        for(int i = b.size(); i < r.size(); i++)sum += b[0] - r[i]; 
    }else{
        for(int i = r.size(); i < b.size(); i++)sum += b[i] - r.back(); 
    }
    return sum;
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:30:22: warning: comparison of integer expressions of different signedness: 'int' and 'const long unsigned int' [-Wsign-compare]
   30 |     for(int i = 0; i < min(r.size(), b.size()); i++)sum += b[i] - r[i];
      |                    ~~^~~~~~~~~~~~~~~~~~~~~~~~~
wiring.cpp:32:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for(int i = b.size(); i < r.size(); i++)sum += b[0] - r[i];
      |                               ~~^~~~~~~~~~
wiring.cpp:34:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for(int i = r.size(); i < b.size(); i++)sum += b[i] - r.back();
      |                               ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 21 ms 2844 KB Output is correct
4 Correct 21 ms 2932 KB Output is correct
5 Correct 17 ms 2936 KB Output is correct
6 Correct 21 ms 3772 KB Output is correct
7 Correct 22 ms 3760 KB Output is correct
8 Correct 27 ms 3800 KB Output is correct
9 Correct 21 ms 3752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 308 KB Output is correct
2 Incorrect 1 ms 304 KB 3rd lines differ - on the 1st token, expected: '17703', found: '-19052'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 3rd lines differ - on the 1st token, expected: '27', found: '12'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -