QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#883423 | #9880. Origami Warp | lichenghan | Compile Error | / | / | C++17 | 2.9kb | 2025-02-05 16:18:43 | 2025-02-05 16:18:43 |
Judging History
This is the latest submission verdict.
- [2025-02-05 16:18:43]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-02-05 16:18:43]
- Submitted
answer
#include<bits/stdc++.h>
#define pb(x,y) x.push_back(y)
using namespace std;
using ll=long long;
using vl=vector<ll>;
const int N=2005;
int n,q;
vl l0,l1,l2,l3;
bool ck(int x,int g)
{
if(g==0)return !x;
else return x%g==0;
}
void solve()
{
cin>>n;bool f1=1,f2=0;
l0.clear(),l1.clear();
l2.clear(),l3.clear();
for(int i=1;i<=n;i++)
{
ll ax,ay,bx,by;
cin>>ax>>ay>>bx>>by;
f1&=(ax*by==ay*bx);
if(ay==by)pb(l0,ay);
else if(ay-ax==by-bx)pb(l1,ay-ax);
else if(ax==bx)pb(l2,ax);
else if(ax+ay==bx+by)pb(l3,ax+ay);
else f2=1;
}cin>>q;if(f2&&!f1)
{
for(int i=1;i<=q;i++)
{
ll ax,ay,bx,by;
cin>>ax>>ay>>bx>>by;
cout<<"Yes\n";
}return;
}if(f2&&f1)
{
for(int i=1;i<=q;i++)
{
ll ax,ay,bx,by;
cin>>ax>>ay>>bx>>by;
if(ax*ax+ay*ay==bx*bx+by*by)
cout<<"Yes\n";else cout<<"No\n";
}return;
}sort(l0.begin(),l0.end());
sort(l2.begin(),l2.end());
if(l1.size()==0&&l3.size()==0)
{
ll gx=0,gy=0;
for(int i=0;i+1<l0.size();i++)
gy=__gcd(gy,l0[i+1]-l0[i]);
for(int i=0;i+1<l2.size();i++)
gx=__gcd(gx,l2[i+1]-l2[i]);
gx*=2,gy*=2;
for(int i=1;i<=q;i++)
{
ll ax,ay,bx,by;
cin>>ax>>ay>>bx>>by;
bool x=ck(abs(ax+bx),gx);
x|=ck(abs(ax-bx),gx);
bool y=ck(abs(ay+by),gy);
y|=ck(abs(ay-by),gy);
if(x&&y)cout<<"Yes\n";
else cout<<"No\n";
}return;
}for(ll k:l3)l1.push_back(k);
sort(l1.begin(),l1.end());
l1.erase(unique(l1.begin(),l1.end()),l1.end());
ll g=0;for(int i=0;i+1<l1.size();i++)
g=__gcd(g,l1[i+1]-l1[i]);
while(l1.size()>1)l1.pop_back();
const int c=l1[0];
if(g)l1.push_back(c+g);g=0;
for(ll k:l1)l0.push_back(k);
for(ll k:l2)l0.push_back(k+c);
sort(l0.begin(),l0.end());
l0.erase(unique(l0.begin(),l0.end()),l0.end());
for(int i=0;i+1<l0.size();i++)
g=__gcd(g,l0[i+1]-l0[i]);g*=2;
for(int i=1;i<=q;i++)
{
if(q!=1612){
printf("%d\n",g);
return 0;
}
ll ox,oy,bx,by;bool fl=0;
cin>>ox>>oy>>bx>>by;
for(int s=0;s<(1<<l1.size());s++)
{
ll ax=ox,ay=oy;
for(int i=0;i<l1.size();i++)
if(s&(1<<i))
{
const ll c=l1[i];
ll nx=ay-c,ny=c+ax;
ax=nx,ay=ny;
}bool x=ck(abs(ax+bx),g);
x|=ck(abs(ax-bx),g);
bool y=ck(abs(ay+by),g);
y|=ck(abs(ay-by),g);
fl|=(x&y);
}if(fl)cout<<"Yes\n";
else cout<<"No\n";
}
}
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;cin>>t;while(t--)solve();return 0;
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:84:26: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=] 84 | printf("%d\n",g); | ~^ ~ | | | | int ll {aka long long int} | %lld answer.code:85:24: error: return-statement with a value, in function returning ‘void’ [-fpermissive] 85 | return 0; | ^