Submission #137088

#TimeUsernameProblemLanguageResultExecution timeMemory
137088KLPPTuna (COCI17_tuna)C++14
50 / 50
2 ms376 KiB
#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 (stderr)

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