제출 #426964

#제출 시각아이디문제언어결과실행 시간메모리
426964oscar1f전선 연결 (IOI17_wiring)C++17
13 / 100
35 ms2756 KiB
#include<bits/stdc++.h> /*#include <cassert> #include <cstdio>*/ #include "wiring.h" using namespace std; const long long MILLE=1000; const long long INFINI=MILLE*MILLE*MILLE*MILLE*MILLE*MILLE,ZERO=0; const int MAX_NB=100*1000; int nbRouge,nbBleu,deb; long long prix; int rouge[MAX_NB],bleu[MAX_NB]; long long min_total_length(vector<int> r, vector<int> b) { nbRouge=r.size(); nbBleu=b.size(); for (int i=0;i<nbRouge;i++) { rouge[i]=r[i]; } for (int i=0;i<nbBleu;i++) { bleu[i]=b[i]; } if (nbRouge>nbBleu) { for (int i=0;nbRouge-i>nbBleu;i++) { deb++; prix+=(long long)b[0]-(long long)r[i]; } for (int i=0;i<nbBleu;i++) { prix+=(long long)b[i]-(long long)r[deb+i]; } } else { for (int i=0;nbBleu-i>nbRouge;i++) { deb++; prix+=(long long)b[i]-(long long)r[nbRouge-1]; } for (int i=0;i<nbRouge;i++) { prix+=(long long)b[deb+i]-(long long)r[i]; } } return prix; } /* int main() { int n, m; assert(2 == scanf("%d %d", &n, &m)); vector<int> r(n), b(m); for(int i = 0; i < n; i++) assert(1 == scanf("%d", &r[i])); for(int i = 0; i < m; i++) assert(1 == scanf("%d", &b[i])); long long res = min_total_length(r, b); printf("%lld\n", res); return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...