Submission #315196

# Submission time Handle Problem Language Result Execution time Memory
315196 2020-10-22T04:31:10 Z thtsshz_bgwrswh Mouse (info1cup19_mouse) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("Ofast")
#include "grader.h"
#include<stdio.h>
#include<algorithm>
#include<assert.h>
using namespace std;
int num[500];
bool right[500],wrong[500];
void solve(int n){
	int i,j;
	for(i=0;i<n;i++)
		wrong[i]=right[i]=0;
	vector<int> vec(n);
	for(i=0;i<n;i++)
		vec[i]=i+1;
	random_shuffle(vec.begin(),vec.end());
	int now=query(vec);
	if(now==n)
		return;
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			if(right[i]||right[j]||wrong[i]||wrong[j])
				continue;
			swap(vec[j],vec[i]);
			int v=query(vec);
			if(v==n)
				return;
			if(v==now-2)
				right[i]=right[j]=1;
			else if(v==now)
				wrong[i]=wrong[j]=1;
			swap(vec[i],vec[j]);
		}
	} 
	vector<int> order;
	for(i=0;i<n;i++)
		if(wrong[i])
			order.emplace_back(i);
	for(i=0;i<n;i++)
		right[i]=0;
	for(i=0;i<(int)order.size();i++){
		for(j=i+1;j<(int)order.size();j++){
			if(right[order[j]])
				continue;
			swap(vec[order[i]],vec[order[j]]);
			int v=query(vec);
			if(v==n)
				return;
			if(v==now+2){
				now+=2;
				right[order[i]]=right[order[j]]=1;
				break;
			}
			swap(vec[order[i]],vec[order[j]]);
		}
	}
}

Compilation message

mouse.cpp: In function 'void solve(int)':
mouse.cpp:12:12: error: reference to 'right' is ambiguous
   12 |   wrong[i]=right[i]=0;
      |            ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~
mouse.cpp:22:7: error: reference to 'right' is ambiguous
   22 |    if(right[i]||right[j]||wrong[i]||wrong[j])
      |       ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~
mouse.cpp:22:17: error: reference to 'right' is ambiguous
   22 |    if(right[i]||right[j]||wrong[i]||wrong[j])
      |                 ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~
mouse.cpp:29:5: error: reference to 'right' is ambiguous
   29 |     right[i]=right[j]=1;
      |     ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~
mouse.cpp:29:14: error: reference to 'right' is ambiguous
   29 |     right[i]=right[j]=1;
      |              ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~
mouse.cpp:40:3: error: reference to 'right' is ambiguous
   40 |   right[i]=0;
      |   ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~
mouse.cpp:43:7: error: reference to 'right' is ambiguous
   43 |    if(right[order[j]])
      |       ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~
mouse.cpp:51:5: error: reference to 'right' is ambiguous
   51 |     right[order[i]]=right[order[j]]=1;
      |     ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~
mouse.cpp:51:21: error: reference to 'right' is ambiguous
   51 |     right[order[i]]=right[order[j]]=1;
      |                     ^~~~~
In file included from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from grader.h:5,
                 from mouse.cpp:2:
/usr/include/c++/9/bits/ios_base.h:1014:3: note: candidates are: 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |   ^~~~~
mouse.cpp:8:6: note:                 'bool right [500]'
    8 | bool right[500],wrong[500];
      |      ^~~~~