Task: | Sukujuhla |
Sender: | Kuha |
Submission time: | 2017-01-22 12:00:38 +0200 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:28:24: error: reference to 'hash' is ambiguous 28 | v[i] = hash(v[i]); | ^~~~ In file included from /usr/include/c++/11/bits/basic_string.h:6860, from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from input/code.cpp:1: /usr/include/c++/11/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ input/code.cpp:18:5: n...
Code
#include <bits/stdc++.h>#define N (1<<18)#define ll long long#define ld long double#define M 1000000007#define INF 1000000007#define LINF 1000000000000000007LL#define pii pair<int, int>#define pll pair<long long, long long>#define pb push_back#define F first#define S second#define L length() - 1using namespace std;int hash (int n) {return (rand() + n) % 3;}int main () {int n, m, k;cin>>n>>m>>k;int v[2 * k + 1];for (int i = 0; i < 2 * k + 1; i++) {cin>>v[i];v[i] = hash(v[i]);}for (int i = 0; i <= k; i++) {while (v[i] == v[i + 1] || v[i + 1] == v[i + 2]) {v[i + 1] = (v[i + 1] + 1) % 3;}}cout<<v[k] + 1<<endl;}