QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#78301#5419. TrianglesExplodingKonjacWA 2ms3440kbC++175.7kb2023-02-17 17:26:242023-02-17 17:26:25

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-17 17:26:25]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3440kb
  • [2023-02-17 17:26:24]
  • 提交

answer

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

namespace FastIO
{

class FastIOBase
{
 protected:
#ifdef OPENIOBUF
	static const int BUFSIZE=1<<22;
	char buf[BUFSIZE+1];
	int buf_p=0;
#endif
	FILE *target;
 public:
#ifdef OPENIOBUF
	virtual void flush()=0;
#endif
	FastIOBase(FILE *f): target(f){}
	~FastIOBase()=default;
};

class FastOutput: public FastIOBase
{
#ifdef OPENIOBUF
 public:
	inline void flush()
		{ fwrite(buf,1,buf_p,target),buf_p=0; }
#endif
 protected:
	inline void __putc(char x)
	{
#ifdef OPENIOBUF
		if(buf[buf_p++]=x,buf_p==BUFSIZE)flush();
#else
		putc(x,target);
#endif
	}
	template<typename T>
	inline void __write(T x)
	{
		static char stk[64],*top;top=stk;
		if(x<0) return __putc('-'),__write(-x);
		do *(top++)=x%10,x/=10; while(x);
		for(;top!=stk;__putc(*(--top)+'0'));
	}
 public:
	FastOutput(FILE *f=stdout): FastIOBase(f){}
#ifdef OPENIOBUF
	inline void setTarget(FILE *f) { this->flush(),target=f; }
	~FastOutput(){ flush(); }
#else
	inline void setTarget(FILE *f) { target=f; }
#endif
	template<typename ...T>
	inline void writesp(const T &...x)
		{ initializer_list<int>{(this->operator<<(x),__putc(' '),0)...}; }
	template<typename ...T>
	inline void writeln(const T &...x)
		{ initializer_list<int>{(this->operator<<(x),__putc('\n'),0)...}; }
	inline FastOutput &operator <<(char x)
		{ return __putc(x),*this; }
	inline FastOutput &operator <<(const char *s)
		{ for(;*s;__putc(*(s++)));return *this; }
	inline FastOutput &operator <<(const string &s)
		{ return (*this)<<s.c_str(); }
	template<typename T,typename=typename enable_if<is_integral<T>::value>::type>
	inline FastOutput &operator <<(const T &x)
		{ return __write(x),*this; }
}qout;

class FastInput: public FastIOBase
{
#ifdef OPENIOBUF
 public:
	inline void flush()
		{ buf[fread(buf,1,BUFSIZE,target)]='\0',buf_p=0; }
#endif
 protected:
	inline char __getc()
	{
#ifdef OPENIOBUF
		if(buf_p==BUFSIZE) flush();
		return buf[buf_p++];
#else
		return getc(target);
#endif
	}
 public:
#ifdef OPENIOBUF
	FastInput(FILE *f=stdin): FastIOBase(f){ buf_p=BUFSIZE; }
	inline void setTarget(FILE *f) { this->flush(),target=f; }
#else
	FastInput(FILE *f=stdin): FastIOBase(f){}
	inline void setTarget(FILE *f) { target=f; }
#endif
	inline char getchar() { return __getc(); }
	template<typename ...T>
	inline void read(T &...x)
		{ initializer_list<int>{(this->operator>>(x),0)...}; }
	inline FastInput &operator >>(char &x)
		{ while(isspace(x=__getc()));return *this; }
	template<typename T,typename=typename enable_if<is_integral<T>::value>::type>
	inline FastInput &operator >>(T &x)
	{
		static char ch,sym;x=sym=0;
		while(isspace(ch=__getc()));
		if(ch=='-') sym=1,ch=__getc();
		for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=__getc());
		return sym?x=-x:x,*this;
	}
	inline FastInput &operator >>(char *s)
	{
		while(isspace(*s=__getc()));
		for(;!isspace(*s) && *s && ~*s;*(++s)=__getc());
		return *s='\0',*this;
	}
	inline FastInput &operator >>(string &s)
	{
		char str_buf[(1<<8)+1],*p=str_buf;
		char *const buf_end=str_buf+(1<<8);
		while(isspace(*p=__getc()));
		for(s.clear(),p++;;p=str_buf)
		{
			for(;p!=buf_end && !isspace(*p=__getc()) && *p && ~*p;p++);
			*p='\0',s.append(str_buf);
			if(p!=buf_end) break;
		}
		return *this;
	}
}qin;

} // namespace FastIO
using namespace FastIO;

using LL=long long;
using LD=long double;
using UI=unsigned int;
using ULL=unsigned long long;

#ifndef DADALZY
#define FILEIO(file) freopen(file".in","r",stdin),freopen(file".out","w",stdout)
#else
#define FILEIO(file)
#endif

constexpr int sol1[][3][2]={ // 8 triangles
	{{0,0},{100,0},{0,100}},
	{{0,100},{45,25},{50,100}},
	{{45,25},{55,25},{50,100}},
	{{100,0},{100,100},{55,25}},
	{{100,0},{55,25},{50,0}},
	{{45,25},{55,25},{50,0}},
	{{0,0},{45,25},{50,0}},
	{{100,100},{55,25},{50,100}}
},
sol2[][3][2]={ // 9 triangles
	{{0,0},{0,100},{70,50}},
	{{0,100},{60,100},{49,65}},
	{{75,75},{60,100},{49,65}},
	{{75,75},{70,50},{49,65}},
	{{100,100},{75,75},{60,100}},
	{{100,100},{75,75},{100,60}},
	{{75,75},{70,50},{100,60}},
	{{0,0},{100,0},{70,50}},
	{{100,0},{70,50},{100,60}}
},
sol3[][3][2]={ // 10 triangles
	{{0,0},{0,100},{45,25}},
	{{0,100},{45,25},{50,100}},
	{{0,0},{45,25},{47,0}},
	{{45,25},{55,25},{50,100}},
	{{45,25},{50,25},{47,0}},
	{{50,25},{53,0},{47,0}},
	{{55,25},{50,25},{53,0}},
	{{100,100},{55,25},{50,100}},
	{{100,0},{55,25},{53,0}},
	{{100,0},{100,100},{55,25}}
},
SCALE=1e7;

int n;
int main()
{
	qin>>n;
	if(n<8) return qout<<"No",0;
	int a[2],b[2],c[2];
	qout<<"Yes\n";
	if(n%3==0) for(auto &[A,B,C]: sol2)
	{
		a[0]=A[0]*SCALE,a[1]=A[1]*SCALE,qout<<a[0]<<' '<<a[1]<<' ';
		b[0]=B[0]*SCALE,b[1]=B[1]*SCALE,qout<<b[0]<<' '<<b[1]<<' ';
		c[0]=C[0]*SCALE,c[1]=C[1]*SCALE,qout<<c[0]<<' '<<c[1]<<'\n';
		n--;
	}
	else if(n%3==1) for(auto &[A,B,C]: sol3)
	{
		a[0]=A[0]*SCALE,a[1]=A[1]*SCALE,qout<<a[0]<<' '<<a[1]<<' ';
		b[0]=B[0]*SCALE,b[1]=B[1]*SCALE,qout<<b[0]<<' '<<b[1]<<' ';
		c[0]=C[0]*SCALE,c[1]=C[1]*SCALE,qout<<c[0]<<' '<<c[1]<<'\n';
		n--;
	}
	else for(auto &[A,B,C]: sol1)
	{
		a[0]=A[0]*SCALE,a[1]=A[1]*SCALE,qout<<a[0]<<' '<<a[1]<<' ';
		b[0]=B[0]*SCALE,b[1]=B[1]*SCALE,qout<<b[0]<<' '<<b[1]<<' ';
		c[0]=C[0]*SCALE,c[1]=C[1]*SCALE,qout<<c[0]<<' '<<c[1]<<'\n';
		n--;
	}
	while(n--)
	{
		int na[2],nb[2],nc[2];
		na[0]=(a[0]+b[0])/2,na[1]=(a[1]+b[1])/2;
		nb[0]=(b[0]+c[0])/2,nb[1]=(b[1]+c[1])/2;
		nc[0]=(c[0]+a[0])/2,nc[1]=(c[1]+a[1])/2;
		a[0]=na[0],a[1]=na[1],qout<<a[0]<<' '<<a[1]<<' ';
		b[0]=nb[0],c[1]=nb[1],qout<<b[0]<<' '<<b[1]<<' ';
		c[0]=nc[0],c[1]=nc[1],qout<<c[0]<<' '<<c[1]<<'\n';
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3316kb

input:

2

output:

No

result:

ok no solution

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3440kb

input:

24

output:

Yes
0 0 0 1000000000 700000000 500000000
0 1000000000 600000000 1000000000 490000000 650000000
750000000 750000000 600000000 1000000000 490000000 650000000
750000000 750000000 700000000 500000000 490000000 650000000
1000000000 1000000000 750000000 750000000 600000000 1000000000
1000000000 1000000000...

result:

wrong answer triangle 11 not acute