QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#310674#5419. Trianglesc20230201Compile Error//C++144.1kb2024-01-21 16:48:372024-01-21 16:48:38

Judging History

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

  • [2024-01-21 16:48:38]
  • 评测
  • [2024-01-21 16:48:37]
  • 提交

answer

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

int a[8][6]={
{0,0,9,5,10,0},
{0,0,9,5,0,20},
{10,0,9,5,11,5},
{10,0,11,5,20,0},
{20,0,11,5,20,20},
{20,20,10,20,11,5},
{10,20,11,5,9,5},
{10,20,9,5,0,20}
};

int b[9][6]={
{0,0,5,4,9,0},
{0,0,5,4,0,7},
{0,7,8,9,5,4},
{0,7,8,9,0,20},
{9,0,10,5,20,0},
{10,5,20,0,20,20},
{0,20,10,5,20,20},
{5,4,8,9,10,5},
{5,4,10,5,9,0}
};

int c[10][6]={
{0,0,9,0,8,4},
{10,3,8,4,9,0},
{10,3,9,0,11,0},
{10,3,11,0,12,4},
{10,3,8,4,10,5},
{10,3,12,4,10,5},
{20,0,11,0,12,4},
{20,20,10,5,20,0},
{0,20,10,5,20,20},
{0,0,10,5,0,20}
};

struct tri {
	int x1,y1,x2,y2,x3,y3;
};

queue<tri> q;

void pt(int k) {
	while(k) {
		tri t=q.front(); q.pop();
		if((t.x1&1)||(t.x2&1)||(t.x3&1)||(t.y1&1)||(t.y2&1)||(t.y3&1)) {
			cout<<"?\n";
			q.push(t);
			continue;
		}
		q.push((tri){(t.x1+t.x2)/2,(t.y1+t.y2)/2,(t.x1+t.x3)/2,(t.y1+t.y3)/2,(t.x2+t.x3)/2,(t.y2+t.y3)/2});
		q.push((tri){(t.x1+t.x2)/2,(t.y1+t.y2)/2,(t.x1+t.x3)/2,(t.y1+t.y3)/2,t.x1,t.y1});
		q.push((tri){(t.x2+t.x1)/2,(t.y2+t.y1)/2,(t.x2+t.x3)/2,(t.y2+t.y3)/2,t.x2,t.y2});
		q.push((tri){(t.x3+t.x1)/2,(t.y3+t.y1)/2,(t.x3+t.x2)/2,(t.y3+t.y2)/2,t.x3,t.y3});
		k--;
	}
	while(q.size()) {
		tri t=q.front(); q.pop();
//		check(t);
		cout<<t.x1<<' '<<t.y1<<' '<<t.x2<<' '<<t.y2<<' '<<t.x3<<' '<<t.y3<<'\n';
	}
	return ;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	for(int i=0;i<8;i++) {
		for(int j=0;j<6;j++) a[i][j]*=5e7;
	}
	for(int i=0;i<9;i++) {
		for(int j=0;j<6;j++) b[i][j]*=5e7;
	}
	for(int i=0;i<10;i++) {
		for(int j=0;j<6;j++) c[i][j]*=5e7;
	}
	int k; cin>>k;
	if(k<8) cout<<"No\n";
	else {
		cout<<"Yes\n";
		if(k%3==0) {
			for(int i=0;i<9;i++) q.push((tri){b[i][0],b[i][1],b[i][2],b[i][3],b[i][4],b[i][5]});
			pt((k-9)/3);
		}
		if(k%3==1) {
			for(int i=0;i<10;i++) q.push((tri){c[i][0],c[i][1],c[i][2],c[i][3],c[i][4],c[i][5]});
			pt((k-10)/3);
		}
		if(k%3==2) {
			for(int i=0;i<8;i++) q.push((tri){a[i][0],a[i][1],a[i][2],a[i][3],a[i][4],a[i][5]});
			pt((k-8)/3);
		}
	}
	return 0;
}#include<bits/stdc++.h>
using namespace std;

int a[8][6]={
{0,0,9,5,10,0},
{0,0,9,5,0,20},
{10,0,9,5,11,5},
{10,0,11,5,20,0},
{20,0,11,5,20,20},
{20,20,10,20,11,5},
{10,20,11,5,9,5},
{10,20,9,5,0,20}
};

int b[9][6]={
{0,0,5,5,9,0},
{0,0,5,5,0,6},
{0,6,9,7,5,5},
{0,6,9,7,0,20},
{9,0,10,5,20,0},
{10,5,20,0,20,20},
{0,20,10,5,20,20},
{5,5,9,7,10,5},
{5,5,10,5,9,0}
};

int c[10][6]={
{0,0,9,0,8,4},
{10,3,8,4,9,0},
{10,3,9,0,11,0},
{10,3,11,0,12,4},
{10,3,8,4,10,5},
{10,3,12,4,10,5},
{20,0,11,0,12,4},
{20,20,10,5,20,0},
{0,20,10,5,20,20},
{0,0,10,5,0,20}
};

struct tri {
	int x1,y1,x2,y2,x3,y3;
};

queue<tri> q;

void pt(int k) {
	while(k) {
		tri t=q.front(); q.pop();
		if((t.x1&1)||(t.x2&1)||(t.x3&1)||(t.y1&1)||(t.y2&1)||(t.y3&1)) {
			q.push(t);
			continue;
		}
		q.push((tri){(t.x1+t.x2)/2,(t.y1+t.y2)/2,(t.x1+t.x3)/2,(t.y1+t.y3)/2,(t.x2+t.x3)/2,(t.y2+t.y3)/2});
		q.push((tri){(t.x1+t.x2)/2,(t.y1+t.y2)/2,(t.x1+t.x3)/2,(t.y1+t.y3)/2,t.x1,t.y1});
		q.push((tri){(t.x2+t.x1)/2,(t.y2+t.y1)/2,(t.x2+t.x3)/2,(t.y2+t.y3)/2,t.x2,t.y2});
		q.push((tri){(t.x3+t.x1)/2,(t.y3+t.y1)/2,(t.x3+t.x2)/2,(t.y3+t.y2)/2,t.x3,t.y3});
		k--;
	}
	while(q.size()) {
		tri t=q.front(); q.pop();
		cout<<t.x1<<' '<<t.y1<<' '<<t.x2<<' '<<t.y2<<' '<<t.x3<<' '<<t.y3<<'\n';
	}
	return ;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	for(int i=0;i<8;i++) {
		for(int j=0;j<6;j++) a[i][j]*=5e7;
	}
	for(int i=0;i<9;i++) {
		for(int j=0;j<6;j++) b[i][j]*=5e7;
	}
	for(int i=0;i<10;i++) {
		for(int j=0;j<6;j++) c[i][j]*=5e7;
	}
	int k; cin>>k;
	if(k<8) cout<<"No\n";
	else {
		cout<<"Yes\n";
		if(k%3==0) {
			for(int i=0;i<9;i++) q.push((tri){b[i][0],b[i][1],b[i][2],b[i][3],b[i][4],b[i][5]});
			pt((k-9)/3);
		}
		if(k%3==1) {
			for(int i=0;i<10;i++) q.push((tri){c[i][0],c[i][1],c[i][2],c[i][3],c[i][4],c[i][5]});
			pt((k-10)/3);
		}
		if(k%3==2) {
			for(int i=0;i<8;i++) q.push((tri){a[i][0],a[i][1],a[i][2],a[i][3],a[i][4],a[i][5]});
			pt((k-8)/3);
		}
	}
	return 0;
}

详细

answer.code:98:2: error: stray ‘#’ in program
   98 | }#include<bits/stdc++.h>
      |  ^
answer.code:98:3: error: ‘include’ does not name a type
   98 | }#include<bits/stdc++.h>
      |   ^~~~~~~
answer.code:101:5: error: redefinition of ‘int a [8][6]’
  101 | int a[8][6]={
      |     ^
answer.code:4:5: note: ‘int a [8][6]’ previously defined here
    4 | int a[8][6]={
      |     ^
answer.code:112:5: error: redefinition of ‘int b [9][6]’
  112 | int b[9][6]={
      |     ^
answer.code:15:5: note: ‘int b [9][6]’ previously defined here
   15 | int b[9][6]={
      |     ^
answer.code:124:5: error: redefinition of ‘int c [10][6]’
  124 | int c[10][6]={
      |     ^
answer.code:27:5: note: ‘int c [10][6]’ previously defined here
   27 | int c[10][6]={
      |     ^
answer.code:137:8: error: redefinition of ‘struct tri’
  137 | struct tri {
      |        ^~~
answer.code:40:8: note: previous definition of ‘struct tri’
   40 | struct tri {
      |        ^~~
answer.code:141:12: error: redefinition of ‘std::queue<tri> q’
  141 | queue<tri> q;
      |            ^
answer.code:44:12: note: ‘std::queue<tri> q’ previously declared here
   44 | queue<tri> q;
      |            ^
answer.code:143:6: error: redefinition of ‘void pt(int)’
  143 | void pt(int k) {
      |      ^~
answer.code:46:6: note: ‘void pt(int)’ previously defined here
   46 | void pt(int k) {
      |      ^~
answer.code:163:5: error: redefinition of ‘int main()’
  163 | int main() {
      |     ^~~~
answer.code:68:5: note: ‘int main()’ previously defined here
   68 | int main() {
      |     ^~~~