QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#864748 | #5652. Controllers | juancs# | WA | 12ms | 3808kb | C++20 | 1.3kb | 2025-01-20 23:10:32 | 2025-01-20 23:10:32 |
Judging History
answer
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef vector<int>vi;
typedef pair<int, int> ii;
typedef tree<int,null_type,less<int>, rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
#define el '\n'
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define forn(i,n) for(int i = 0; i < n;++i)
#define pb push_back
#define db(x) cerr << #x << ' ' << x << el;
void solve(){
int n;
cin >> n;
string s;
cin >> s;
ll p = 0, neg = 0;
forn(i, n){
if(s[i] == '+')++p;
else ++neg;
}
int q;
cin >> q;
auto check = [&](ll x, ll y){
ll xy = x - y;
ll num = x*neg - y*p;
if(xy == 0){
return num == 0;
}
if(num % xy != 0)return false;
ll div = num / xy;
if(div < 0)return false;
return div <= p + n;
};
forn(_, q){
ll x, y;
cin >> x >> y;
if(check(x, y))cout << "YES" << el;
else cout << "NO" << el;
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int tt = 1;
// cin>>tt;
while(tt--)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
8 +-+---+- 5 2 1 10 3 7 9 10 10 5 3
output:
YES NO NO NO YES
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
6 +-++-- 2 9 7 1 1
output:
YES YES
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
20 +-----+--+--------+- 2 1000000000 99999997 250000000 1000000000
output:
NO YES
result:
ok 2 lines
Test #4:
score: -100
Wrong Answer
time: 12ms
memory: 3808kb
input:
183132 +++-++-+++--+++++-+++---++++++-+-+-+---++++--+++++-+++++-+-+-++-++-++-+++--+++++++-+++++--++-+++-+++-+-++--++++-++++-+++-++++-+-+++++-----+++-++++++++++-++++++++++++++-+++-+-++++---++-++++---+++++++--++++-++++-+-+-+++++-+---+-++++-++++-++-+++++++++-++---++++++++++++-+++-++++++-+++-+-+++++++++...
output:
NO NO YES NO YES NO NO NO NO NO YES NO NO YES NO NO YES NO YES YES NO YES NO NO NO NO YES NO NO NO NO YES NO NO NO NO NO NO YES YES NO NO NO YES YES NO NO YES YES YES NO NO NO NO NO NO YES NO NO YES YES YES YES YES NO YES YES NO NO NO YES NO YES NO NO NO NO YES NO YES NO NO YES NO NO NO YES NO NO NO...
result:
wrong answer 196th lines differ - expected: 'NO', found: 'YES'