QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#224339#7179. Fischer's Chess Guessing Gamefikusm9Compile Error//C++142.0kb2023-10-23 01:24:522023-10-23 01:24:52

Judging History

你现在查看的是最新测评结果

  • [2023-10-23 01:24:52]
  • 评测
  • [2023-10-23 01:24:52]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
using namespace std;

vector<int> v1;
vector<int> v2;
vector<string> v;
vector<string> w1;
string s;
int r1,r2,k,b1,b2,q,m1,m2,r;
map<pair<string,int>,int> m;

void upit(vector<string> w){
	m2=1000;
	for(int i=0; i<w.size(); i++){
		m1=0;
		for(int t=0; t<8; t++){
			m1=max(m1,m[{w[i],t}]);
		}
		if(m1<m2){
			m2=m1;
			r=i;
		}
	}
	cout << w[r] << "\n";
	cout << fflush;
	cin >> koliko;
	for(auto u:w){
		//ako ima koliko istih sa w[r] ubaci ga u w1;
	}
}

int main() {
	cin >> s;
	for(int r1=0; r1<8; r1++){
		for(int r2=r1+1; r2<8; r2++){
			for(int k=r1+1; k<r2; k++){
				v1.clear();
				for(int i=0; i<8; i++){
					if(i!=r1 && i!=r2 && i!=k){
						v1.pb(i);
					}
				}
				for(int i1=0; i1<5; i1++){
					for(int i2=i1+1; i2<5; i2++){
						b1=v1[i1];
						b2=v1[i2];
						if((b2-b1)%2==1){
							v2.clear();
							for(int i=0; i<5; i++){
								if(v1[i]!=b1 && v1[i]!=b2){
									v2.pb(i);
								}
							}
							q=v2[0];
							s="NNNNNNNN";
							for(int i=0; i<8; i++){
								if(i==r1 || i==r2) s[i]='R';
								else if(i==k) s[i]='K';
								else if(i==b1 || i==b2) s[i]='B';
								else if(i==q) s[i]='Q';
							}
							v.pb(s);
							q=v2[1];
							s="NNNNNNNN";
							for(int i=0; i<8; i++){
								if(i==r1 || i==r2) s[i]='R';
								else if(i==k) s[i]='K';
								else if(i==b1 || i==b2) s[i]='B';
								else if(i==q) s[i]='Q';
							}
							v.pb(s);
							q=v2[2];
							s="NNNNNNNN";
							for(int i=0; i<8; i++){
								if(i==r1 || i==r2) s[i]='R';
								else if(i==k) s[i]='K';
								else if(i==b1 || i==b2) s[i]='B';
								else if(i==q) s[i]='Q';
							}
							v.pb(s);
						}
					}
				}
			}
		}
	}
	cout << v.size() << "\n";
	for(int i=0; i<v.size(); i++){
		for(int j=i; j<v.size(); j++){
			t=0;
			for(int t=0; t<8; t++){
				if(v[i][t]==v[j][t]) tr++;
			}
			m[{v[i],t}]++;
			m[{v[j],t}]++;
		}
	}
	upit(v);
}

Details

answer.code: In function ‘void upit(std::vector<std::__cxx11::basic_string<char> >)’:
answer.code:27:16: error: ‘koliko’ was not declared in this scope
   27 |         cin >> koliko;
      |                ^~~~~~
answer.code: In function ‘int main()’:
answer.code:91:25: error: ‘t’ was not declared in this scope
   91 |                         t=0;
      |                         ^
answer.code:93:54: error: ‘tr’ was not declared in this scope; did you mean ‘t’?
   93 |                                 if(v[i][t]==v[j][t]) tr++;
      |                                                      ^~
      |                                                      t
answer.code:95:26: error: no match for ‘operator[]’ (operand types are ‘std::map<std::pair<std::__cxx11::basic_string<char>, int>, int>’ and ‘<brace-enclosed initializer list>’)
   95 |                         m[{v[i],t}]++;
      |                          ^
In file included from /usr/include/c++/11/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:81,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_map.h:492:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<std::__cxx11::basic_string<char>, int>; _Tp = int; _Compare = std::less<std::pair<std::__cxx11::basic_string<char>, int> >; _Alloc = std::allocator<std::pair<const std::pair<std::__cxx11::basic_string<char>, int>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<std::__cxx11::basic_string<char>, int>]’
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const key_type&’ {aka ‘const std::pair<std::__cxx11::basic_string<char>, int>&’}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_map.h:512:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<std::__cxx11::basic_string<char>, int>; _Tp = int; _Compare = std::less<std::pair<std::__cxx11::basic_string<char>, int> >; _Alloc = std::allocator<std::pair<const std::pair<std::__cxx11::basic_string<char>, int>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<std::__cxx11::basic_string<char>, int>]’
  512 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_map.h:512:29: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘std::map<std::pair<std::__cxx11::basic_string<char>, int>, int>::key_type&&’ {aka ‘std::pair<std::__cxx11::basic_string<char>, int>&&’}
  512 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
answer.code:96:26: error: no match for ‘operator[]’ (operand types are ‘std::map<std::pair<std::__cxx11::basic_string<char>, int>, int>’ and ‘<brace-enclosed initializer list>’)
   96 |                         m[{v[j],t}]++;
      |                          ^
In file included from /usr/include/c++/11/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:81,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_map.h:492:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<std::__cxx11::basic_string<char>, int>; _Tp = int; _Compare = std::less<std::pair<std::__cxx11::basic_string<char>, int> >; _Alloc = std::allocator<std::pair<const std::pair<std::__cxx11::basic_string<char>, int>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<std::__cxx11::basic_string<char>, int>]’
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const key_type&’ {aka ‘const std::pair<std::__cxx11::basic_string<char>, int>&’}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_map.h:512:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<std::__cxx11::basic_string<char>, int>; _Tp = int; _Compare = std::less<std::pair<std::__cxx11::basic_string<char>, int> >; _Alloc = std::allocator<std::pair<const std::pair<std::__cxx11::basic_string<char>, int>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = int; std::map<_Key, _Tp, _Compare, _Alloc>:...