QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#424789 | #7277. Bring Down the | Lynkcat# | 0 | 180ms | 15732kb | C++20 | 1.5kb | 2024-05-29 17:17:56 | 2024-05-29 17:17:57 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
// #define int ll
// #define N
using namespace std;
int S,Q;
map<tuple<int,int,int,int>,int>Mp;
inline int dfs(int x,int y,int a,int b)
{
if (x<=0) return 0;
if (a<=0) return 1;
if (x<=b*S&&a<=y*S)
{
int t=min(-x+b*S,-a+y*S)/S+1;
b-=t,y-=t;
}
if (b==0) return dfs(a-x+b*S,b,x,y)^1;
if (x<=b*S) return dfs(a,b-1,x,y)^1;
if (x-b*S>=S&&a<=y*S) return 1;
if (Mp.count({x,y,a,b})) return Mp[{x,y,a,b}];
int &res=Mp[{x,y,a,b}];
res=0;
if (x>b*S)
{
res=dfs(a-x+b*S,b,x,y)^1;
if (res)return res;
} else
if (b>0)
{
res=dfs(a,b-1,x,y)^1;
if (res)return res;
}
return 0;
}
mt19937_64 rnd(time(0));
const int B=2000;
void BellaKira()
{
cin>>S>>Q;
while (Q--)
{
int x,y,a,b;
x=rnd()%B+1,y=rnd()%B+1,a=rnd()%B+1,b=rnd()%B+1;
cin>>x>>y>>a>>b;
if (dfs(x,y,a,b)) cout<<"YES\n";
else cout<<"NO\n";
}
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
while (T--)
{
BellaKira();
}
}
/*list:
1.mod 998244353 or 1e9+7 or ???
2.N
3.duipai shuju xingtai duoyidian
...
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 0ms
memory: 3800kb
input:
17 2 42 1 33 1 42 1 33 7
output:
YES NO
result:
ok 2 token(s): yes count is 1, no count is 1
Test #2:
score: -5
Wrong Answer
time: 180ms
memory: 15732kb
input:
2 250000 75 16 56 55 50 9 49 60 18 67 62 5 30 54 61 39 22 39 42 31 26 30 55 1 23 30 53 16 55 13 6 44 69 8 58 72 53 7 60 12 29 14 26 34 37 64 24 71 19 3 40 1 64 13 33 65 67 24 68 3 64 17 50 66 71 6 62 13 15 29 26 24 51 30 34 45 46 5 40 72 54 52 60 49 35 21 18 30 39 31 35 34 30 74 72 5 74 12 6 15 11 4...
output:
NO NO YES NO NO YES NO NO NO YES NO YES NO NO YES NO YES NO NO NO YES YES YES YES YES NO YES YES NO YES YES NO NO YES NO NO YES NO YES NO NO NO NO YES YES NO NO NO YES NO YES NO NO YES YES YES NO NO NO NO YES NO NO NO YES YES NO YES NO YES YES YES NO YES YES NO YES NO YES NO YES NO NO NO NO NO NO YE...
result:
wrong answer expected YES, found NO [4th token]
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #28:
score: 0
Wrong Answer
time: 77ms
memory: 14592kb
input:
1 250000 554333015044 833858497873 833858497874 554333015044 655160857180 306396306924 306396306917 655160857187 374728598365 176680698490 176680698490 374728598365 764650258714 835600427315 835600427309 764650258720 521594231110 318048536486 318048536482 521594231115 273627794040 449769302710 10899...
output:
YES YES YES NO YES NO NO YES YES NO YES YES NO YES NO YES YES NO YES NO YES NO YES NO YES YES YES NO YES NO NO YES NO YES YES YES YES NO YES NO NO YES YES YES NO NO YES YES YES YES YES NO NO YES YES YES NO YES NO YES NO NO NO YES YES NO NO YES YES YES NO YES NO NO NO YES YES YES NO NO YES YES NO YES...
result:
wrong answer expected NO, found YES [1st token]
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #3:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%