| Task: | Tunnels |
| Sender: | Majakas |
| Submission time: | 2017-01-21 01:23:32 +0200 |
| Language: | C++ |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:14:19: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type' has no member named 'f'
inout[t1].f++;
^
input/code.cpp:15:19: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type' has no member named 's'
inout[t2].s++;
^
input/code.cpp:20:30: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type' has no member named 'f'
answ += abs(inout[i].f - inout[i].s);
^
input/code.cpp:20:43: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type' has no member named 's'
answ += abs(inout[i].f - inout[i].s);
^Code
#include <bits/stdc++.h>
using namespace::std;
ifstream fin("input.txt");
int main()
{
int n, m, t1, t2;
cin >> n >> m;
vector<pair<int, int> > inout(n + 1);
for (int i = 0; i < m; i++) {
cin >> t1 >> t2;
inout[t1].f++;
inout[t2].s++;
}
int answ = 0;
for (int i = 1; i <= n; i++) {
answ += abs(inout[i].f - inout[i].s);
}
answ /= 2;
cout << answ << "\n";
}
