Submission #275116

# Submission time Handle Problem Language Result Execution time Memory
275116 2020-08-20T04:29:55 Z 반딧불(#5115) Radio (Balkan15_RADIO) C++17
30 / 100
72 ms 7400 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, k;
ll x[100002], p[100002], s[100002];
ll ans, loc;
vector<ll> v;

int main(){
    scanf("%d %d", &n, &k);
    for(int i=1; i<=n; i++){
        scanf("%d %d %d", &x[i], &p[i], &s[i]);
        v.push_back(x[i]-p[i]);
        v.push_back(x[i]+p[i]);
    }
    sort(v.begin(), v.end());
    loc = v[n-1];
    for(int i=1; i<=n; i++){
        ans += max(0LL, abs(loc - x[i]) - p[i]);
    }
    printf("%lld", ans);
}

Compilation message

radio.cpp: In function 'int main()':
radio.cpp:15:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
   15 |         scanf("%d %d %d", &x[i], &p[i], &s[i]);
      |                ~^         ~~~~~
      |                 |         |
      |                 int*      ll* {aka long long int*}
      |                %lld
radio.cpp:15:20: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'll*' {aka 'long long int*'} [-Wformat=]
   15 |         scanf("%d %d %d", &x[i], &p[i], &s[i]);
      |                   ~^             ~~~~~
      |                    |             |
      |                    int*          ll* {aka long long int*}
      |                   %lld
radio.cpp:15:23: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'll*' {aka 'long long int*'} [-Wformat=]
   15 |         scanf("%d %d %d", &x[i], &p[i], &s[i]);
      |                      ~^                 ~~~~~
      |                       |                 |
      |                       int*              ll* {aka long long int*}
      |                      %lld
radio.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);
      |     ~~~~~^~~~~~~~~~~~~~~~~
radio.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |         scanf("%d %d %d", &x[i], &p[i], &s[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 4 ms 768 KB Output is correct
7 Correct 15 ms 1788 KB Output is correct
8 Correct 30 ms 3532 KB Output is correct
9 Correct 58 ms 6260 KB Output is correct
10 Correct 48 ms 5872 KB Output is correct
11 Correct 72 ms 7400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -