답안 #414641

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
414641 2021-05-30T19:57:22 Z Carmel_Ab1 전선 연결 (IOI17_wiring) C++17
0 / 100
1 ms 296 KB
#include<bits/stdc++.h>
#include "wiring.h"
using namespace std;

//#include "grader.cpp"

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int>vi;
typedef vector<vector<int>>vvi;
typedef vector<ll>vl;
typedef vector<vl> vvl;
typedef pair<int,int>pi;
typedef pair<ll,ll> pl;
typedef vector<pl> vpl;
typedef vector<ld> vld;
typedef pair<ld,ld> pld;
//typedef tree<ll, null_type, less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<typename T> ostream& operator<<(ostream& os, vector<T>& a){os<<"[";for(int i=0; i<ll(a.size()); i++){os << a[i] << ((i!=ll(a.size()-1)?" ":""));}os << "]\n"; return os;}

#define all(x) x.begin(),x.end()
#define YES out("YES")
#define NO out("NO")
#define out(x){cout << x << "\n"; return;}
#define GLHF ios_base::sync_with_stdio(false); cin.tie(NULL)
#define print(x){for(auto ait:x) cout << ait << " "; cout << "\n";}
#define pb push_back
#define umap unordered_map

template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1, T2>& p){is >> p.first >> p.second;return is;}
template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1, T2>& p){os <<"" << p.first << " " << p.second << ""; return os;}

ll min_total_length(vi r, vi b){
    set<int> bp,rp;
    int n=r.size(),m=b.size();

    for(int i=0; i<n; i++)
        rp.insert(r[i]);
    for(int i=0; i<m; i++)
        bp.insert(b[i]);

    ll ans=0;
    if(n==1 && m==1)
        return abs(b[0]-r[0]);
    
    for(int i=0; i<n-1; i++)
        ans+=abs(r[i]-b[0]);
    for(int i=1; i<m; i++)
        ans+=abs(b[i]-r.back());
    return ans;

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '25859', found: '47553'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '904', found: '943'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '316', found: '348'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 296 KB 3rd lines differ - on the 1st token, expected: '27', found: '122'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '25859', found: '47553'
2 Halted 0 ms 0 KB -