Submission #201663

# Submission time Handle Problem Language Result Execution time Memory
201663 2020-02-11T16:25:00 Z SamAnd Tuna (COCI17_tuna) C++17
50 / 50
5 ms 376 KB
#include <bits/stdc++.h>
using namespace std;

int qq;
int x;

int main()
{
    scanf("%d%d", &qq, &x);
    int ans = 0;
    while (qq--)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        if (a > b)
            swap(a, b);
        if ((b - a) <= x)
            ans += b;
        else
        {
            int c;
            scanf("%d", &c);
            ans += c;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Compilation message

tuna.cpp: In function 'int main()':
tuna.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &qq, &x);
     ~~~~~^~~~~~~~~~~~~~~~~
tuna.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~
tuna.cpp:22:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &c);
             ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct