# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
921773 | 2024-02-04T10:00:33 Z | Ludissey | Palembang Bridges (APIO15_bridge) | C++14 | 2000 ms | 604 KB |
#include <bits/stdc++.h> #define int long long using namespace std; vector<char> P; vector<int> S; vector<char> Q; vector<int> T; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int l=0; int r=100; int n,k; cin >> k >> n; P.resize(n); S.resize(n); Q.resize(n); T.resize(n); for (int i = 0; i < n; i++){ cin >> P[i] >> S[i] >> Q[i] >> T[i]; } int mn=1e12; for (int j = 0; j < n*2; j++) { int x1; if(j%2==0) x1=S[j/2]; else x1=T[j/2]; for (int j2 = j+1; j2 < n*2; j2++){ int sum=0; int x2; if(j%2==0) x2=S[j2/2]; else x2=T[j2/2]; for (int i = 0; i < n; i++) { if(P[i]!=Q[i]) { int s1=abs(x1-S[i])+1+abs(x1-T[i]); int s2=abs(x2-S[i])+1+abs(x2-T[i]); sum+=min(s1,s2); } else sum+=abs(S[i]-T[i]); } mn=min(sum,mn); } } cout << mn<< "\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Execution timed out | 2077 ms | 348 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Execution timed out | 2069 ms | 348 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 6 ms | 348 KB | Output is correct |
4 | Correct | 5 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 460 KB | Output is correct |
6 | Correct | 0 ms | 356 KB | Output is correct |
7 | Correct | 6 ms | 344 KB | Output is correct |
8 | Correct | 6 ms | 344 KB | Output is correct |
9 | Correct | 6 ms | 452 KB | Output is correct |
10 | Correct | 6 ms | 348 KB | Output is correct |
11 | Correct | 5 ms | 344 KB | Output is correct |
12 | Correct | 6 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 5 ms | 452 KB | Output is correct |
4 | Correct | 5 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 532 KB | Output is correct |
7 | Correct | 6 ms | 452 KB | Output is correct |
8 | Correct | 6 ms | 604 KB | Output is correct |
9 | Correct | 5 ms | 348 KB | Output is correct |
10 | Correct | 5 ms | 348 KB | Output is correct |
11 | Correct | 6 ms | 348 KB | Output is correct |
12 | Correct | 6 ms | 348 KB | Output is correct |
13 | Execution timed out | 2036 ms | 344 KB | Time limit exceeded |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 6 ms | 452 KB | Output is correct |
4 | Correct | 5 ms | 344 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 5 ms | 456 KB | Output is correct |
8 | Correct | 6 ms | 344 KB | Output is correct |
9 | Correct | 5 ms | 348 KB | Output is correct |
10 | Correct | 5 ms | 348 KB | Output is correct |
11 | Correct | 6 ms | 452 KB | Output is correct |
12 | Correct | 5 ms | 348 KB | Output is correct |
13 | Execution timed out | 2089 ms | 348 KB | Time limit exceeded |
14 | Halted | 0 ms | 0 KB | - |