QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#424755 | #7277. Bring Down the | Lynkcat# | 0 | 0ms | 3668kb | C++20 | 1.3kb | 2024-05-29 16:49:27 | 2024-05-29 16:49:27 |
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 (Mp.count({x,y,a,b})) return Mp[{x,y,a,b}];
int &res=Mp[{x,y,a,b}];
if (x>b*S)
{
res=dfs(a-x+b*S,b,x,y);
if (res==0)
{
res=1;
return res;
}
}
res=dfs(a,b-1,x,y);
// if (res==0)
if (res==0)
{
res=1;
return res;
}
// cout<<x<<" "<<y<<" "<<a<<" "<<b<<" "<<" "<<res<<endl;
return 0;
}
void BellaKira()
{
cin>>S>>Q;
while (Q--)
{
int x,y,a,b;
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
...
*/
详细
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 5
Accepted
time: 0ms
memory: 3668kb
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
Time Limit Exceeded
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 NO NO NO YES NO YES NO NO NO YES NO NO YES YES NO YES YES NO YES YES NO NO YES NO NO YES NO YES YES NO NO NO YES YES YES YES NO YES NO YES NO YES YES YES YES YES NO NO NO YES NO NO NO YES YES NO YES NO YES NO YES YES YES YES NO YES YES YES NO YES NO NO NO NO YES Y...
result:
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Memory Limit Exceeded
Test #28:
score: 0
Memory Limit Exceeded
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:
result:
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%