# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
448514 | 2021-07-30T10:47:28 Z | bigDuck | Palembang Bridges (APIO15_bridge) | C++14 | 1 ms | 332 KB |
#include<bits/stdc++.h> using namespace std; #define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define mp make_pair #define pb push_back #define ft first #define sc second #define ll long long #define pii pair<int, int> #define count_bits __builtin_popcount #define int ll int n, k; int s[100010], t[100010]; char p[100010], q[100010]; int get_1(){ vector<int> pts; pts.clear(); int s0=0; for(int i=1; i<=n; i++){ if(p[i]==q[i]){ s0+=abs(s[i]-t[i]); } else{ pts.pb(s[i]); pts.pb(t[i]); } } sort(pts.begin(), pts.end()); int res=1e18; int s1=0, s2=0; int k1=0, k2=0; for(int x:pts){ s2+=x; } k2=pts.size(); for(int i=0; i<pts.size(); i++){ k2--; k1++; s1+=pts[i], s2-=pts[i]; res=min(res, pts[i]*k1-s1+s2-pts[i]*k2+s0+((int)pts.size()/2)); /* if(pts[i]*k1-s1+s2-pts[i]*k2+s0==20){ cout<<(i+1)<<"\n"; } */ } return res; } int get_2(){ return 0; } int32_t main(){ INIT cin>>k>>n; for(int i=1; i<=n; i++){ cin>>p[i]>>s[i]>>q[i]>>t[i]; } if(k==1){ cout<<get_1()<<"\n"; } else{ cout<<get_2()<<"\n"; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 324 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |