Submission #1110635

# Submission time Handle Problem Language Result Execution time Memory
1110635 2024-11-10T06:34:01 Z vjudge1 Tuna (COCI17_tuna) C++17
50 / 50
1 ms 508 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

int teklif_sayisi, fark, teklif1, teklif2, teklif3, buyuk_teklif, kucuk_teklif, total_teklif;

int32_t main()
{
    cin >> teklif_sayisi >> fark;
    
    for (int i = 0; i < teklif_sayisi; i++)
    {
        cin >> teklif1 >> teklif2;
        
        if(teklif1 >= teklif2){
            buyuk_teklif = teklif1;
            kucuk_teklif = teklif2;
        }
        else{
            buyuk_teklif = teklif2;
            kucuk_teklif = teklif1;
        }

        if(buyuk_teklif - kucuk_teklif <= fark){
            total_teklif += buyuk_teklif;
        }
        else{
            cin >> teklif3;
            total_teklif += teklif3;
        }
    }

    cout << total_teklif << endl;
    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 508 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct