Task: | Auraus |
Sender: | Eero Salla |
Submission time: | 2020-02-09 14:18:46 +0200 |
Language: | C++ (C++11) |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:24:22: error: 'a' was not declared in this scope long c = abs(a-b)+1; ^ input/code.cpp:24:24: error: 'b' was not declared in this scope long c = abs(a-b)+1; ^
Code
#include <bits/stdc++.h>using namespace std;typedef long long ll;int main(){long n, m, k;cin >> n >> m >> k;long cnt = 0;vector<long> cs(m);for(int i = 0; i < m; i++){long a, b;cin >> a >> b;cs[i] = abs(a-b)+1;}sort(cs.begin(), cs.end());for(int i = 0; i < m; i++){long c = abs(a-b)+1;cout << "C:" << c << endl;if(k >= c){k-=c;cnt++;}}cout << cnt << endl;}