QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#71983#2965. RSA Mistakericky0129#WA 89ms14344kbC++141.6kb2023-01-13 01:51:032023-01-13 01:51:04

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-13 01:51:04]
  • 评测
  • 测评结果:WA
  • 用时:89ms
  • 内存:14344kb
  • [2023-01-13 01:51:03]
  • 提交

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) mp[a]++;
        }
        if(isPrime(b)) mp[b]++;
        else{
            for(ll x: P){
                while(b%x==0){
                    mp[x]++;
                    b/=x;
                }
            }
            if(b!=1) 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: 13428kb

input:

13 23

output:

full credit

result:

ok single line: 'full credit'

Test #2:

score: 0
Accepted
time: 71ms
memory: 12796kb

input:

35 6

output:

partial credit

result:

ok single line: 'partial credit'

Test #3:

score: 0
Accepted
time: 55ms
memory: 14344kb

input:

4 5

output:

no credit

result:

ok single line: 'no credit'

Test #4:

score: 0
Accepted
time: 52ms
memory: 12604kb

input:

17 17

output:

no credit

result:

ok single line: 'no credit'

Test #5:

score: 0
Accepted
time: 63ms
memory: 12300kb

input:

15 21

output:

no credit

result:

ok single line: 'no credit'

Test #6:

score: 0
Accepted
time: 89ms
memory: 13140kb

input:

545528636581 876571629707

output:

no credit

result:

ok single line: 'no credit'

Test #7:

score: 0
Accepted
time: 80ms
memory: 12608kb

input:

431348146441 3

output:

no credit

result:

ok single line: 'no credit'

Test #8:

score: 0
Accepted
time: 73ms
memory: 13432kb

input:

584803025179 200560490130

output:

partial credit

result:

ok single line: 'partial credit'

Test #9:

score: 0
Accepted
time: 67ms
memory: 12396kb

input:

725769156026 520807975733

output:

partial credit

result:

ok single line: 'partial credit'

Test #10:

score: 0
Accepted
time: 66ms
memory: 13008kb

input:

94785999423 831843785340

output:

no credit

result:

ok single line: 'no credit'

Test #11:

score: 0
Accepted
time: 78ms
memory: 13428kb

input:

962631984045 923583932904

output:

no credit

result:

ok single line: 'no credit'

Test #12:

score: -100
Wrong Answer
time: 62ms
memory: 14064kb

input:

983892174682 596267564620

output:

partial credit

result:

wrong answer 1st lines differ - expected: 'no credit', found: 'partial credit'