QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#219841 | #7583. Faraway | PhantomThreshold# | WA | 20ms | 3812kb | C++20 | 1.5kb | 2023-10-19 19:02:43 | 2023-10-19 19:02:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=60;
ll gao(ll L,ll R,ll a){
L-=a;
R-=a;
ll restR=R%mod;
if (restR<0) restR+=mod;
ll restL=L%mod;
if (restL>0) restL-=mod;
L-=restL;
R-=restR;
return (R-L)/mod+1;
}
ll n,m;
ll x[20],y[20],k[20],t[20];
void solve(){
cin >> n >> m;
for (int i=1;i<=n;i++) cin >> x[i] >> y[i] >> k[i] >> t[i];
vector<ll> vx,vy;
for (int i=1;i<=n;i++){
vx.push_back(x[i]);
vy.push_back(y[i]);
}
vx.push_back(0);vx.push_back(m+1);
vy.push_back(0);vy.push_back(m+1);
sort(vx.begin(),vx.end());
sort(vy.begin(),vy.end());
int szx=vx.size();
int szy=vy.size();
ll ans=0;
for (int selx=1;selx<szx;selx++){
ll lx=vx[selx-1];
ll rx=vx[selx]-1;
if (lx>rx) continue;
for (int sely=1;sely<szy;sely++){
ll ly=vy[sely-1];
ll ry=vy[sely]-1;
if (ly>ry) continue;
for (ll a=0;a<mod;a++){
for (ll b=0;b<mod;b++){
bool flag=1;
for (int i=1;i<=n;i++){
ll tmp=0;
if (lx>=x[i]) tmp+=x[i]-a;
else tmp+=a-x[i];
if (ly>=y[i]) tmp+=y[i]-b;
else tmp+=b-y[i];
tmp=tmp%k[i];
if (tmp<0) tmp+=k[i];
if (tmp!=t[i]){
flag=0;
break;
}
}
if (!flag) continue;
ans+=gao(lx,rx,a)*gao(ly,ry,b);
}
}
}
}
cout << ans << "\n";
}
int main(){
ios_base::sync_with_stdio(false);
int Tcase=10;
cin >> Tcase;
for (;Tcase--;){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3812kb
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: 3620kb
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 27537525 3787846786 0 0 4683311356556196 41089411832962 4699214996739
result:
wrong answer 4th numbers differ - expected: '116256265', found: '27537525'