제출 #434160

#제출 시각아이디문제언어결과실행 시간메모리
434160bipartite_matching선물상자 (IOI15_boxes)C++14
10 / 100
1 ms204 KiB
#include <bits/stdc++.h> #include "boxes.h" #define forint(i, N) for (int i = 0; i < (N); i++) using namespace std; typedef long long ll; ll delivery(int n, int k, int l, int p[]) { vector<int> dist(n); for (int i = 0; i < n; i++) { dist[i] = min(p[i], l - p[i]); } ll ret = 0; int pos = 0; int a = 0; while (pos < n) { if (a != 0) { ret += (ll)p[pos] - p[pos - 1]; } else { ret += (ll)dist[pos]; } a++; if (a == k || (pos < n - 1 && p[pos + 1] - p[pos] > dist[pos + 1]) || pos == n - 1) { ret += (ll)dist[pos]; a = 0; } pos++; } return ret; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...