답안 #596990

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
596990 2022-07-15T11:11:19 Z f1nder Tuna (COCI17_tuna) C++17
0 / 50
2 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
void solve();
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
 
   #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("error.txt", "w", stderr);
   freopen("output.txt", "w", stdout);
   #endif
   
int t=1;
while(t--)
{
	solve();
	cout<<"\n";
}

cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
return 0;
}
void solve()
{
    int n,k;cin>>n>>k;
    int ans=0;
    for (int i = 0; i < n; i++) {
        /* code */
        int h,j;cin>>h>>j;
        if(abs(h-j)<=k) ans+=max(h,j);
        else{
            int l;cin>>l;
            ans+=l;
        }
    }
    cout<<ans;
}	

Compilation message

tuna.cpp: In function 'int main()':
tuna.cpp:9:11: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |    freopen("input.txt", "r", stdin);
      |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
tuna.cpp:10:11: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |    freopen("error.txt", "w", stderr);
      |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
tuna.cpp:11:11: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |    freopen("output.txt", "w", stdout);
      |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -