Submission #677373

# Submission time Handle Problem Language Result Execution time Memory
677373 2023-01-03T06:37:14 Z Cross_Ratio None (JOI15_walls) C++14
10 / 100
3000 ms 2260 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int A[200005];
int B[200005];
int L[200005];
int ans[200005];
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int N, M;
    cin >> N >> M;
    int i, j;
    for(i=0;i<N;i++) cin >> A[i] >> B[i];
    for(i=0;i<N;i++) L[i] = B[i] - A[i];
    for(i=0;i<M;i++) {
        int c;
        cin >> c;
        for(j=0;j<N;j++) {
            if(c<A[j]) {
                ans[j] += A[j] - c;
                A[j] = c, B[j] = c + L[j];
            }
            else if(c > B[j]) {
                ans[j] += c - B[j];
                B[j] = c, A[j] = c - L[j];
            }
        }
    }
    for(i=0;i<N;i++) cout << ans[i] << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 23 ms 2252 KB Output is correct
3 Correct 23 ms 2256 KB Output is correct
4 Correct 22 ms 2252 KB Output is correct
5 Correct 22 ms 2252 KB Output is correct
6 Correct 21 ms 2256 KB Output is correct
7 Correct 20 ms 2004 KB Output is correct
8 Correct 21 ms 2260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1293 ms 1212 KB Output is correct
2 Execution timed out 3063 ms 1844 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 23 ms 2252 KB Output is correct
3 Correct 23 ms 2256 KB Output is correct
4 Correct 22 ms 2252 KB Output is correct
5 Correct 22 ms 2252 KB Output is correct
6 Correct 21 ms 2256 KB Output is correct
7 Correct 20 ms 2004 KB Output is correct
8 Correct 21 ms 2260 KB Output is correct
9 Correct 1293 ms 1212 KB Output is correct
10 Execution timed out 3063 ms 1844 KB Time limit exceeded
11 Halted 0 ms 0 KB -