QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#116864#6668. TrokutiLaurie#Compile Error//C++148.8kb2023-06-30 09:33:362024-05-31 18:32:25

Judging History

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

  • [2024-05-31 18:32:25]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 09:33:36]
  • 提交

answer

//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <random>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
#define vi vector<int>
#define ull unsigned long long
#define mem0(x) memset(x,0,sizeof(x))
#define mem0x3f(x) memset(x,0x3f,sizeof(x))
using namespace std;
using std::bitset;
//using namespace __gnu_pbds;
const double Pi=acos(-1);
namespace fastIO {
	template<class T>
	inline void read(T &x) {
		x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		if(fu)x=-x;
	}
	inline int read() {
		int x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		return fu?-x:x;
	}
	template<class T,class... Args>
	inline void read(T& t,Args&... args) {
		read(t);
		read(args...);
	}
	char _n_u_m_[40];
	template<class T>
	inline void write(T x) {
		if(x==0){
			putchar('0');
			return;
		}
		T tmp = x > 0 ? x : -x ;
		if( x < 0 ) putchar('-') ;
		register int cnt = 0 ;
		while( tmp > 0 ) {
			_n_u_m_[ cnt ++ ] = tmp % 10 + '0' ;
			tmp /= 10 ;
		}
		while( cnt > 0 ) putchar(_n_u_m_[ -- cnt ]) ;
	}
	template<class T>
	inline void write(T x ,char ch) {
		write(x);
		putchar(ch);
	}
}
using namespace fastIO;
int n=100,m=6;
int g[102][102],ans[102][102],qwq;
mt19937 rd(1234);
void init(){
	F(i,1,n)F(j,i+1,n)ans[i][j]=ans[j][i]=rd()&1;
}
inline int query(int x,int y,int z){
	++qwq;
	printf("? %d %d %d\n",x,y,z);
	fflush(stdout);
//	return ans[x][y]+ans[y][z]+ans[x][z];
	return read();
}
int id[102][102],cnt,A[100002],B[100002],C[100002],D[100002],tot,p[102];
void solve(){
	F(i,1,m)F(j,1,i)g[i][j]=g[j][i];
	F(i,m+1,n){
		F(j,1,i-1)p[j]=j;
		shuffle(p+1,p+i,rd);
		vector<int>res;
		int now=0;
		while(now<i-1){
			++now;
			if(res.empty()){
				res.push_back(p[now]);
				++now;
			}
			if(now==i)break;
			int v=query(res.back(),p[now],i)-g[res.back()][p[now]];
			if(v==0){
				g[i][p[now]]=0;
				int now=0;
				while(res.size()){
					g[i][res.back()]=now;
					now^=1;
					res.pop_back();
				}
			}else if(v==2){
				g[i][p[now]]=1;
				int now=1;
				while(res.size()){
					g[i][res.back()]=now;
					now^=1;
					res.pop_back();
				}
			}else res.push_back(p[now]);
		}
		if(res.size()>=3){
			if(query(res[0],res[2],i)<=1){
				F(j,0,res.size()-1)g[i][res[j]]=(j&1);
			}else{
				F(j,0,res.size()-1)g[i][res[j]]=(j&1)^1;
			}
		}else if(res.size()){
			int v=query(res.back(),p[0],i)-g[res.back()][p[0]]-g[i][p[0]];
			if(v){
				int now=1;
				while(res.size()){
					g[i][res.back()]=now;
					now^=1;
					res.pop_back();
				}
			}else{
				int now=0;
				while(res.size()){
					g[i][res.back()]=now;
					now^=1;
					res.pop_back();
				}
			}
		}
		F(j,1,i-1)g[j][i]=g[i][j];
	}
	
	
	
	
//	F(i,1,n)F(j,1,n)if(g[i][j]!=ans[i][j]){
//		cerr<<"WA"<<" "<<i<<" "<<j<<" "<<g[i][j]<<" "<<ans[i][j]<<endl;
//		return;
//	}
	puts("!");
	F(i,1,n){
		F(j,1,n)putchar(g[i][j]+'0');
		putchar('\n');
	}
	fflush(stdout);
	cerr<<qwq<<endl;
}
inline bool check(){
	F(i,1,tot)if(g[A[i]][B[i]]+g[B[i]][C[i]]+g[A[i]][C[i]]!=D[i]){
		return false;
	}
	return true;
}
inline void dfs(int x,int y){
	if(x==m){
		if(check()){
			solve();
			exit(0);
		}
	}else{
		g[x][y]=0;
		if(y==m)dfs(x+1,x+2);
		else dfs(x,y+1);
		g[x][y]=1;
		if(y==m)dfs(x+1,x+2);
		else dfs(x,y+1);
	}
}
int main() {
	init();
	F(i,1,n)F(j,i+1,n)id[i][j]=id[j][i]=++cnt;
	F(i,1,m)F(j,i+1,m)F(k,j+1,m){
		++tot;
		A[tot]=i,B[tot]=j,C[tot]=k;
		D[tot]=query(i,j,k);//cerr<<D[tot]<<endl;
	}
	dfs(1,2);
	return 0;
}

//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <random>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
#define vi vector<int>
#define ull unsigned long long
#define mem0(x) memset(x,0,sizeof(x))
#define mem0x3f(x) memset(x,0x3f,sizeof(x))
using namespace std;
using std::bitset;
//using namespace __gnu_pbds;
const double Pi=acos(-1);
namespace fastIO {
	template<class T>
	inline void read(T &x) {
		x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		if(fu)x=-x;
	}
	inline int read() {
		int x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		return fu?-x:x;
	}
	template<class T,class... Args>
	inline void read(T& t,Args&... args) {
		read(t);
		read(args...);
	}
	char _n_u_m_[40];
	template<class T>
	inline void write(T x) {
		if(x==0){
			putchar('0');
			return;
		}
		T tmp = x > 0 ? x : -x ;
		if( x < 0 ) putchar('-') ;
		register int cnt = 0 ;
		while( tmp > 0 ) {
			_n_u_m_[ cnt ++ ] = tmp % 10 + '0' ;
			tmp /= 10 ;
		}
		while( cnt > 0 ) putchar(_n_u_m_[ -- cnt ]) ;
	}
	template<class T>
	inline void write(T x ,char ch) {
		write(x);
		putchar(ch);
	}
}
using namespace fastIO;
int n=100,m=6;
int g[102][102],ans[102][102],qwq;
mt19937 rd(1234);
void init(){
	F(i,1,n)F(j,i+1,n)ans[i][j]=ans[j][i]=rd()&1;
}
inline int query(int x,int y,int z){
	++qwq;
	printf("? %d %d %d\n",x,y,z);
	fflush(stdout);
//	return ans[x][y]+ans[y][z]+ans[x][z];
	return read();
}
int id[102][102],cnt,A[100002],B[100002],C[100002],D[100002],tot,p[102];
void solve(){
	F(i,1,m)F(j,1,i)g[i][j]=g[j][i];
	F(i,m+1,n){
		F(j,1,i-1)p[j]=j;
		shuffle(p+1,p+i,rd);
		vector<int>res;
		int now=0;
		while(now<i-1){
			++now;
			if(res.empty()){
				res.push_back(p[now]);
				++now;
			}
			if(now==i)break;
			int v=query(res.back(),p[now],i)-g[res.back()][p[now]];
			if(v==0){
				g[i][p[now]]=0;
				int now=0;
				while(res.size()){
					g[i][res.back()]=now;
					now^=1;
					res.pop_back();
				}
			}else if(v==2){
				g[i][p[now]]=1;
				int now=1;
				while(res.size()){
					g[i][res.back()]=now;
					now^=1;
					res.pop_back();
				}
			}else res.push_back(p[now]);
		}
		if(res.size()>=3){
			if(query(res[0],res[2],i)<=1){
				F(j,0,res.size()-1)g[i][res[j]]=(j&1);
			}else{
				F(j,0,res.size()-1)g[i][res[j]]=(j&1)^1;
			}
		}else if(res.size()){
			int v=query(res.back(),p[0],i)-g[res.back()][p[0]]-g[i][p[0]];
			if(v){
				int now=1;
				while(res.size()){
					g[i][res.back()]=now;
					now^=1;
					res.pop_back();
				}
			}else{
				int now=0;
				while(res.size()){
					g[i][res.back()]=now;
					now^=1;
					res.pop_back();
				}
			}
		}
		F(j,1,i-1)g[j][i]=g[i][j];
	}
	
	
	
	
//	F(i,1,n)F(j,1,n)if(g[i][j]!=ans[i][j]){
//		cerr<<"WA"<<" "<<i<<" "<<j<<" "<<g[i][j]<<" "<<ans[i][j]<<endl;
//		return;
//	}
	puts("!");
	F(i,1,n){
		F(j,1,n)putchar(g[i][j]+'0');
		putchar('\n');
	}
	fflush(stdout);
	cerr<<qwq<<endl;
}
inline bool check(){
	F(i,1,tot)if(g[A[i]][B[i]]+g[B[i]][C[i]]+g[A[i]][C[i]]!=D[i]){
		return false;
	}
	return true;
}
inline void dfs(int x,int y){
	if(x==m){
		if(check()){
			solve();
			exit(0);
		}
	}else{
		g[x][y]=0;
		if(y==m)dfs(x+1,x+2);
		else dfs(x,y+1);
		g[x][y]=1;
		if(y==m)dfs(x+1,x+2);
		else dfs(x,y+1);
	}
}
int main() {
	init();
	F(i,1,n)F(j,i+1,n)id[i][j]=id[j][i]=++cnt;
	F(i,1,m)F(j,i+1,m)F(k,j+1,m){
		++tot;
		A[tot]=i,B[tot]=j,C[tot]=k;
		D[tot]=query(i,j,k);//cerr<<D[tot]<<endl;
	}
	dfs(1,2);
	return 0;
}


详细

answer.code:260:14: error: redefinition of ‘const double Pi’
  260 | const double Pi=acos(-1);
      |              ^~
answer.code:43:14: note: ‘const double Pi’ previously defined here
   43 | const double Pi=acos(-1);
      |              ^~
answer.code:263:21: error: redefinition of ‘template<class T> void fastIO::read(T&)’
  263 |         inline void read(T &x) {
      |                     ^~~~
answer.code:46:21: note: ‘template<class T> void fastIO::read(T&)’ previously declared here
   46 |         inline void read(T &x) {
      |                     ^~~~
answer.code:274:20: error: redefinition of ‘int fastIO::read()’
  274 |         inline int read() {
      |                    ^~~~
answer.code:57:20: note: ‘int fastIO::read()’ previously defined here
   57 |         inline int read() {
      |                    ^~~~
answer.code:286:21: error: redefinition of ‘template<class T, class ... Args> void fastIO::read(T&, Args& ...)’
  286 |         inline void read(T& t,Args&... args) {
      |                     ^~~~
answer.code:69:21: note: ‘template<class T, class ... Args> void fastIO::read(T&, Args& ...)’ previously declared here
   69 |         inline void read(T& t,Args&... args) {
      |                     ^~~~
answer.code:290:14: error: redefinition of ‘char fastIO::_n_u_m_ [40]’
  290 |         char _n_u_m_[40];
      |              ^~~~~~~
answer.code:73:14: note: ‘char fastIO::_n_u_m_ [40]’ previously declared here
   73 |         char _n_u_m_[40];
      |              ^~~~~~~
answer.code:292:21: error: redefinition of ‘template<class T> void fastIO::write(T)’
  292 |         inline void write(T x) {
      |                     ^~~~~
answer.code:75:21: note: ‘template<class T> void fastIO::write(T)’ previously declared here
   75 |         inline void write(T x) {
      |                     ^~~~~
answer.code:307:21: error: redefinition of ‘template<class T> void fastIO::write(T, char)’
  307 |         inline void write(T x ,char ch) {
      |                     ^~~~~
answer.code:90:21: note: ‘template<class T> void fastIO::write(T, char)’ previously declared here
   90 |         inline void write(T x ,char ch) {
      |                     ^~~~~
answer.code:313:5: error: redefinition of ‘int n’
  313 | int n=100,m=6;
      |     ^
answer.code:96:5: note: ‘int n’ previously defined here
   96 | int n=100,m=6;
      |     ^
answer.code:313:11: error: redefinition of ‘int m’
  313 | int n=100,m=6;
      |           ^
answer.code:96:11: note: ‘int m’ previously defined here
   96 | int n=100,m=6;
      |           ^
answer.code:314:5: error: redefinition of ‘int g [102][102]’
  314 | int g[102][102],ans[102][102],qwq;
      |     ^
answer.code:97:5: note: ‘int g [102][102]’ previously declared here
   97 | int g[102][102],ans[102][102],qwq;
      |     ^
answer.code:314:17: error: redefinition of ‘int ans [102][102]’
  314 | int g[102][102],ans[102][102],qwq;
      |                 ^~~
answer.code:97:17: note: ‘int ans [102][102]’ previously declared here
   97 | int g[102][102],ans[102][102],qwq;
      |                 ^~~
answer.code:314:31: error: redefinition of ‘int qwq’
  314 | int g[102][102],ans[102][102],qwq;
      |                               ^~~
answer.code:97:31: note: ‘int qwq’ previously declared here
   97 | int g[102][102],ans[102][102],qwq;
      |                               ^~~
answer.code:315:9: error: redefinition of ‘std::mt19937 rd’
  315 | mt19937 rd(1234);
      |         ^~
answer.code:98:9: note: ‘std::mt19937 rd’ previously declared here
   98 | mt19937 rd(1234);
      |         ^~
answer.code:316:6: error: redefinition of ‘void init()’
  316 | void init(){
      |      ^~~~
answer.code:99:6: note: ‘void init()’ previously defined here
   99 | void init(){
      |      ^~~~
answer.code:319:12: error: redefinition of ‘int query(int, int, int)’
  319 | inline int query(int x,int y,int z){
      |            ^~~~~
answer.code:102:12: note: ‘int query(int, int, int)’ previously defined here
  102 | inline int query(int x,int y,int z){
      |            ^~~~~
answer.code:326:5: error: redefinition of ‘int id [102][102]’
  326 | int id[102][102],cnt,A[100002],B[100002],C[100002],D[100002],tot,p[102];
      |     ^~
answer.code:109:5: note: ‘int id [102][102]’ previously declared here
  109 | int id[102][102],cnt,A[100002],B[100002],C[100002],D[100002],tot,p[102];
      |     ^~
answer.code:326:18: error: redefinition of ‘int cnt’
  326 | int id[102][102],cnt,A[100002],B[100002],C[100002],D[100002],tot,p[102];
      |                  ^~~
answer.code:109:18: note: ‘int cnt’ previously declared here
  109 | int id[102][102],cnt,A[100002],B[100002],C[100002],D[100002],tot,p[102];
      |                  ^~~
answer.code:326:22: error: redefinition of ‘int A [100002]’
  326 | int id[102][102],cnt,A[100002],B[100002],C[100002],D[100002],tot,p[102];
      |                      ^
answer.code:109:22: note: ‘int A [100002]’ previously declared here
  109 | int id[102][...