Submission #137088

# Submission time Handle Problem Language Result Execution time Memory
137088 2019-07-27T05:05:57 Z KLPP Tuna (COCI17_tuna) C++14
50 / 50
2 ms 376 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)

int main(){
  int n;
  int X;
  scanf("%d %d",&n,&X);
  int ans=0;
  rep(i,0,n){
    int x,y;
    scanf("%d %d",&x,&y);
    if(max(x,y)-min(x,y)<=X)ans+=max(x,y);
    else{
      int z;
      scanf("%d",&z);
      ans+=z;
    }
  }
  printf("%d\n",ans);
  return 0;
}

Compilation message

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