Submission #677483

# Submission time Handle Problem Language Result Execution time Memory
677483 2023-01-03T12:37:59 Z 79brue None (JOI15_walls) C++17
10 / 100
3000 ms 3636 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, k;
ll a[200002], b[200002];
ll pnt[200002];
ll ans[200002];

int main(){
    scanf("%d %d", &n, &k);
    for(int i=1; i<=n; i++) scanf("%lld %lld", &a[i], &b[i]);
    for(int i=1; i<=k; i++) scanf("%lld", &pnt[i]);
    for(int i=1; i<=n; i++){
        for(int j=1; j<=k; j++){
            if(pnt[j] < a[i]){
                ans[i] += a[i] - pnt[j];
                b[i] -= (a[i] - pnt[j]);
                a[i] = pnt[j];
            }
            else if(b[i] < pnt[j]){
                ans[i] += pnt[j] - b[i];
                a[i] += (pnt[j] - b[i]);
                b[i] = pnt[j];
            }
        }
        printf("%lld\n", ans[i]);
    }
}

Compilation message

walls.cpp: In function 'int main()':
walls.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
walls.cpp:14:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     for(int i=1; i<=n; i++) scanf("%lld %lld", &a[i], &b[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
walls.cpp:15:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     for(int i=1; i<=k; i++) scanf("%lld", &pnt[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 31 ms 2412 KB Output is correct
3 Correct 24 ms 2476 KB Output is correct
4 Correct 30 ms 2416 KB Output is correct
5 Correct 23 ms 2508 KB Output is correct
6 Correct 23 ms 2500 KB Output is correct
7 Correct 21 ms 2416 KB Output is correct
8 Correct 26 ms 2380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1910 ms 1504 KB Output is correct
2 Execution timed out 3056 ms 3636 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 31 ms 2412 KB Output is correct
3 Correct 24 ms 2476 KB Output is correct
4 Correct 30 ms 2416 KB Output is correct
5 Correct 23 ms 2508 KB Output is correct
6 Correct 23 ms 2500 KB Output is correct
7 Correct 21 ms 2416 KB Output is correct
8 Correct 26 ms 2380 KB Output is correct
9 Correct 1910 ms 1504 KB Output is correct
10 Execution timed out 3056 ms 3636 KB Time limit exceeded
11 Halted 0 ms 0 KB -