QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#216229 | #7583. Faraway | SolitaryDream# | WA | 20ms | 3564kb | C++17 | 1.6kb | 2023-10-15 16:51:20 | 2023-10-15 16:51:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=111;
int T,n,m;
int x[N],y[N],k[N],t[N];
int calc(int L,int R,int u)
{
int ret=R/60+(R%60>=u);
if(L>=1)
ret-=((L-1)/60+((L-1)%60>=u));
return ret;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>T;
while(T--)
{
cin>>n>>m;
vector<int> X,Y;
X.push_back(0);
X.push_back(m+1);
Y.push_back(0);
Y.push_back(m+1);
for(int i=1;i<=n;i++)
cin>>x[i]>>y[i]>>k[i]>>t[i],X.push_back(x[i]),Y.push_back(y[i]);
sort(X.begin(),X.end());
sort(Y.begin(),Y.end());
X.erase(unique(X.begin(),X.end()),X.end());
Y.erase(unique(Y.begin(),Y.end()),Y.end());
int ans=0;
for(int i=0;i+1<X.size();i++)
for(int j=0;j+1<Y.size();j++)
{
int lx=X[i],rx=X[i+1]-1;
int ly=Y[j],ry=Y[j+1]-1;
for(int u=0;u<60;u++)
for(int v=0;v<60;v++)
{
bool ok=1;
for(int i=1;i<=n;i++)
if((abs(u-x[i])+abs(v-y[i]))%k[i]!=t[i])
{
ok=0;
break;
}
if(!ok)
continue;
ans+=calc(lx,rx,u)*calc(ly,ry,v);
}
}
cout<<ans<<"\n";
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
2 2 5 1 2 4 2 3 1 2 1 2 5 1 2 4 2 1 2 4 3
output:
10 0
result:
ok 2 number(s): "10 0"
Test #2:
score: -100
Wrong Answer
time: 20ms
memory: 3564kb
input:
10 10 950006 879210 618398 2 0 413993 805537 5 0 614389 782151 5 4 616385 454674 4 2 6020 332147 5 0 77932 43110 4 1 143614 196643 4 0 937161 934707 4 1 318567 789911 4 0 194658 555381 5 3 10 967857178 8983267 44864625 3 2 141087113 359274718 2 1 909006720 262061158 3 0 840340929 715591525 3 2 76531...
output:
0 0 0 0 0 0 0 29017175969211031 0 0
result:
wrong answer 4th numbers differ - expected: '116256265', found: '0'