QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#54943 | #2965. RSA Mistake | Sa3tElSefr# | TL | 18ms | 3712kb | C++ | 1.1kb | 2022-10-11 18:17:33 | 2022-10-11 18:17:36 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define ld double
using namespace std;
const int N = 2e5 + 5, mod = 998244353;
bool isPrime(ll n) {
for(ll i = 2; i * i <= n; i++) {
if(n % i == 0) {
return 0;
}
}
return 1;
}
map<ll, int> get(ll n) {
map<ll, int> ret;
for(int i = 2; i * i <= n; i++) {
while(n % i == 0) {
ret[i]++;
n /= i;
}
}
if(n > 0) ret[n]++;
return ret;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll a, b;
cin >> a >> b;
vector<string> s = {"full credit", "partial credit", "no credit"};
if(isPrime(a) && isPrime(b)) {
if(a == b) cout << s[2];
else cout << s[0];
return 0;
}
auto res = get(a);
auto t = get(b);
for(auto i: t) res[i.first] += i.second;
bool found = 0;
for(auto i: res) {
if(i.second % 2 == 0) {
found = 1;
}
}
if(found) cout << s[2];
else cout << s[1];
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3648kb
input:
13 23
output:
full credit
result:
ok single line: 'full credit'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3648kb
input:
35 6
output:
partial credit
result:
ok single line: 'partial credit'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
4 5
output:
no credit
result:
ok single line: 'no credit'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
17 17
output:
no credit
result:
ok single line: 'no credit'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3632kb
input:
15 21
output:
no credit
result:
ok single line: 'no credit'
Test #6:
score: 0
Accepted
time: 18ms
memory: 3712kb
input:
545528636581 876571629707
output:
no credit
result:
ok single line: 'no credit'
Test #7:
score: 0
Accepted
time: 12ms
memory: 3544kb
input:
431348146441 3
output:
no credit
result:
ok single line: 'no credit'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
584803025179 200560490130
output:
partial credit
result:
ok single line: 'partial credit'
Test #9:
score: -100
Time Limit Exceeded
input:
725769156026 520807975733