QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#71984 | #2965. RSA Mistake | ricky0129# | WA | 86ms | 13816kb | C++14 | 1.7kb | 2023-01-13 01:52:36 | 2023-01-13 01:52:40 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define FOR(i,n) for(int i=0;i<n;i++)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
const int MOD = (int)1e9+7;
bool isPrime(ll a){
for(ll i=2;i*i<=a;i++){
if(a%i==0) return false;
}
return true;
}
const int N = 1e7+1;
int main()
{
vector<bool> prime(N,true);
prime[0] = prime[1] = false;
vll P;
for(int i=2;i<N;i++){
if(!prime[i]) continue;
P.push_back(i);
for(int j=i*2;j<N;j+=i){
prime[j] = false;
}
}
ll a, b;
cin>>a>>b;
if(isPrime(a) && isPrime(b) && a!=b) cout<<"full credit\n";
else{
map<ll,int> mp;
if(isPrime(a)) mp[a]++;
else{
for(ll x: P){
while(a%x==0){
mp[x]++;
a/=x;
}
}
if(a!=1){
assert(isPrime(a));
mp[a]++;
}
}
if(isPrime(b)) mp[b]++;
else{
for(ll x: P){
while(b%x==0){
mp[x]++;
b/=x;
}
}
if(b!=1){
assert(isPrime(b));
mp[b]++;
}
}
bool even = false;
for(auto x: mp){
if(x.s%2==0) even = true;
}
if(even) cout<<"no credit\n";
else cout<<"partial credit\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 61ms
memory: 13496kb
input:
13 23
output:
full credit
result:
ok single line: 'full credit'
Test #2:
score: 0
Accepted
time: 81ms
memory: 13440kb
input:
35 6
output:
partial credit
result:
ok single line: 'partial credit'
Test #3:
score: 0
Accepted
time: 66ms
memory: 13624kb
input:
4 5
output:
no credit
result:
ok single line: 'no credit'
Test #4:
score: 0
Accepted
time: 67ms
memory: 13536kb
input:
17 17
output:
no credit
result:
ok single line: 'no credit'
Test #5:
score: 0
Accepted
time: 76ms
memory: 13496kb
input:
15 21
output:
no credit
result:
ok single line: 'no credit'
Test #6:
score: 0
Accepted
time: 83ms
memory: 12464kb
input:
545528636581 876571629707
output:
no credit
result:
ok single line: 'no credit'
Test #7:
score: 0
Accepted
time: 86ms
memory: 12748kb
input:
431348146441 3
output:
no credit
result:
ok single line: 'no credit'
Test #8:
score: 0
Accepted
time: 76ms
memory: 13816kb
input:
584803025179 200560490130
output:
partial credit
result:
ok single line: 'partial credit'
Test #9:
score: 0
Accepted
time: 72ms
memory: 12508kb
input:
725769156026 520807975733
output:
partial credit
result:
ok single line: 'partial credit'
Test #10:
score: 0
Accepted
time: 71ms
memory: 12912kb
input:
94785999423 831843785340
output:
no credit
result:
ok single line: 'no credit'
Test #11:
score: 0
Accepted
time: 69ms
memory: 13464kb
input:
962631984045 923583932904
output:
no credit
result:
ok single line: 'no credit'
Test #12:
score: -100
Wrong Answer
time: 72ms
memory: 13364kb
input:
983892174682 596267564620
output:
partial credit
result:
wrong answer 1st lines differ - expected: 'no credit', found: 'partial credit'