QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#864743 | #5652. Controllers | juancs# | WA | 13ms | 3940kb | C++20 | 1.2kb | 2025-01-20 22:57:42 | 2025-01-20 22:57:43 |
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;
forn(_, q){
ll x, y;
cin >> x >> y;
ll xy = x - y;
ll num = x*neg - y*p;
if(xy == 0){
if(num == 0)cout << "YES" << el;
else cout << "NO" << el;
continue;
}
if(num % xy == 0 && (num / xy) >= 0)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: 13ms
memory: 3940kb
input:
183132 +++-++-+++--+++++-+++---++++++-+-+-+---++++--+++++-+++++-+-+-++-++-++-+++--+++++++-+++++--++-+++-+++-+-++--++++-++++-+++-++++-+-+++++-----+++-++++++++++-++++++++++++++-+++-+-++++---++-++++---+++++++--++++-++++-+-+-+++++-+---+-++++-++++-++-+++++++++-++---++++++++++++-+++-++++++-+++-+-+++++++++...
output:
NO NO YES YES YES YES YES NO YES YES YES NO YES YES YES NO YES NO YES YES NO YES NO YES NO NO YES NO YES NO NO YES NO NO NO NO NO YES YES YES NO YES NO YES YES NO YES YES YES YES YES NO NO NO YES YES YES NO YES YES YES YES YES YES YES YES YES NO NO YES YES YES YES YES YES YES YES YES NO YES NO NO YE...
result:
wrong answer 4th lines differ - expected: 'NO', found: 'YES'