Submission #201663

#TimeUsernameProblemLanguageResultExecution timeMemory
201663SamAndTuna (COCI17_tuna)C++17
50 / 50
5 ms376 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...