QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#71985#2965. RSA Mistakericky0129#AC ✓101ms14356kbC++141.7kb2023-01-13 01:54:252023-01-13 01:54:28

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:54:28]
  • 评测
  • 测评结果:AC
  • 用时:101ms
  • 内存:14356kb
  • [2023-01-13 01:54:25]
  • 提交

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) even = true;
        }
        if(even) cout<<"no credit\n";
        else cout<<"partial credit\n";
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 61ms
memory: 13400kb

input:

13 23

output:

full credit

result:

ok single line: 'full credit'

Test #2:

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

input:

35 6

output:

partial credit

result:

ok single line: 'partial credit'

Test #3:

score: 0
Accepted
time: 57ms
memory: 13228kb

input:

4 5

output:

no credit

result:

ok single line: 'no credit'

Test #4:

score: 0
Accepted
time: 60ms
memory: 13156kb

input:

17 17

output:

no credit

result:

ok single line: 'no credit'

Test #5:

score: 0
Accepted
time: 81ms
memory: 13204kb

input:

15 21

output:

no credit

result:

ok single line: 'no credit'

Test #6:

score: 0
Accepted
time: 92ms
memory: 13100kb

input:

545528636581 876571629707

output:

no credit

result:

ok single line: 'no credit'

Test #7:

score: 0
Accepted
time: 77ms
memory: 13328kb

input:

431348146441 3

output:

no credit

result:

ok single line: 'no credit'

Test #8:

score: 0
Accepted
time: 69ms
memory: 13688kb

input:

584803025179 200560490130

output:

partial credit

result:

ok single line: 'partial credit'

Test #9:

score: 0
Accepted
time: 83ms
memory: 13784kb

input:

725769156026 520807975733

output:

partial credit

result:

ok single line: 'partial credit'

Test #10:

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

input:

94785999423 831843785340

output:

no credit

result:

ok single line: 'no credit'

Test #11:

score: 0
Accepted
time: 77ms
memory: 13604kb

input:

962631984045 923583932904

output:

no credit

result:

ok single line: 'no credit'

Test #12:

score: 0
Accepted
time: 77ms
memory: 13940kb

input:

983892174682 596267564620

output:

no credit

result:

ok single line: 'no credit'

Test #13:

score: 0
Accepted
time: 76ms
memory: 13908kb

input:

988586693791 523281177667

output:

full credit

result:

ok single line: 'full credit'

Test #14:

score: 0
Accepted
time: 85ms
memory: 12620kb

input:

768483880537 958632922673

output:

full credit

result:

ok single line: 'full credit'

Test #15:

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

input:

695320496641 992131878511

output:

full credit

result:

ok single line: 'full credit'

Test #16:

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

input:

619864432127 575182057589

output:

full credit

result:

ok single line: 'full credit'

Test #17:

score: 0
Accepted
time: 79ms
memory: 14356kb

input:

574224928327 554785761851

output:

full credit

result:

ok single line: 'full credit'

Test #18:

score: 0
Accepted
time: 64ms
memory: 14264kb

input:

2 2

output:

no credit

result:

ok single line: 'no credit'

Test #19:

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

input:

999999999989 999999999961

output:

full credit

result:

ok single line: 'full credit'

Test #20:

score: 0
Accepted
time: 101ms
memory: 13252kb

input:

999999999989 999999999989

output:

no credit

result:

ok single line: 'no credit'

Test #21:

score: 0
Accepted
time: 72ms
memory: 13436kb

input:

2 999999999989

output:

full credit

result:

ok single line: 'full credit'

Test #22:

score: 0
Accepted
time: 74ms
memory: 12912kb

input:

999999999989 2

output:

full credit

result:

ok single line: 'full credit'

Test #23:

score: 0
Accepted
time: 97ms
memory: 13172kb

input:

799337241719 790574179457

output:

no credit

result:

ok single line: 'no credit'

Test #24:

score: 0
Accepted
time: 97ms
memory: 14324kb

input:

999962000357 999944000663

output:

no credit

result:

ok single line: 'no credit'

Test #25:

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

input:

2 4

output:

no credit

result:

ok single line: 'no credit'

Test #26:

score: 0
Accepted
time: 62ms
memory: 13252kb

input:

4 2

output:

no credit

result:

ok single line: 'no credit'

Test #27:

score: 0
Accepted
time: 68ms
memory: 13688kb

input:

21 15

output:

no credit

result:

ok single line: 'no credit'

Test #28:

score: 0
Accepted
time: 70ms
memory: 13396kb

input:

5 4

output:

no credit

result:

ok single line: 'no credit'

Test #29:

score: 0
Accepted
time: 64ms
memory: 13004kb

input:

125 7

output:

no credit

result:

ok single line: 'no credit'

Test #30:

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

input:

999999999969 999999999929

output:

partial credit

result:

ok single line: 'partial credit'

Test #31:

score: 0
Accepted
time: 81ms
memory: 13356kb

input:

428571428541 999999999929

output:

no credit

result:

ok single line: 'no credit'

Test #32:

score: 0
Accepted
time: 75ms
memory: 13364kb

input:

949999999373 714080161721

output:

partial credit

result:

ok single line: 'partial credit'

Test #33:

score: 0
Accepted
time: 94ms
memory: 13256kb

input:

757523014201 616759792799

output:

partial credit

result:

ok single line: 'partial credit'

Test #34:

score: 0
Accepted
time: 98ms
memory: 12468kb

input:

945410323183 793541296879

output:

partial credit

result:

ok single line: 'partial credit'

Test #35:

score: 0
Accepted
time: 83ms
memory: 12556kb

input:

668134918943 250092815711

output:

partial credit

result:

ok single line: 'partial credit'

Test #36:

score: 0
Accepted
time: 88ms
memory: 13708kb

input:

593159028797 378923570503

output:

partial credit

result:

ok single line: 'partial credit'

Test #37:

score: 0
Accepted
time: 97ms
memory: 13300kb

input:

673663445657 685555556761

output:

partial credit

result:

ok single line: 'partial credit'

Test #38:

score: 0
Accepted
time: 75ms
memory: 13612kb

input:

615590502287 730111591619

output:

partial credit

result:

ok single line: 'partial credit'

Test #39:

score: 0
Accepted
time: 94ms
memory: 12664kb

input:

737474530367 339061475591

output:

partial credit

result:

ok single line: 'partial credit'

Test #40:

score: 0
Accepted
time: 94ms
memory: 14228kb

input:

547304948893 825051092141

output:

partial credit

result:

ok single line: 'partial credit'

Test #41:

score: 0
Accepted
time: 81ms
memory: 13900kb

input:

888259990703 349508614421

output:

partial credit

result:

ok single line: 'partial credit'

Test #42:

score: 0
Accepted
time: 76ms
memory: 13932kb

input:

394206923881 679230181703

output:

no credit

result:

ok single line: 'no credit'

Test #43:

score: 0
Accepted
time: 70ms
memory: 13620kb

input:

199036422587 813176211779

output:

no credit

result:

ok single line: 'no credit'

Test #44:

score: 0
Accepted
time: 82ms
memory: 12996kb

input:

385196736923 358517468791

output:

no credit

result:

ok single line: 'no credit'

Test #45:

score: 0
Accepted
time: 86ms
memory: 13608kb

input:

540003052801 543341442493

output:

no credit

result:

ok single line: 'no credit'

Test #46:

score: 0
Accepted
time: 72ms
memory: 13752kb

input:

529883073493 557936045561

output:

no credit

result:

ok single line: 'no credit'

Test #47:

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

input:

519207113731 326410289771

output:

no credit

result:

ok single line: 'no credit'

Test #48:

score: 0
Accepted
time: 86ms
memory: 14252kb

input:

530779897367 729543471779

output:

no credit

result:

ok single line: 'no credit'

Test #49:

score: 0
Accepted
time: 77ms
memory: 13556kb

input:

623202833611 876138576449

output:

no credit

result:

ok single line: 'no credit'

Test #50:

score: 0
Accepted
time: 92ms
memory: 13692kb

input:

741753647069 741753647069

output:

no credit

result:

ok single line: 'no credit'

Test #51:

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

input:

548039 445335943361

output:

no credit

result:

ok single line: 'no credit'

Test #52:

score: 0
Accepted
time: 88ms
memory: 13192kb

input:

644483448731 611801529223

output:

no credit

result:

ok single line: 'no credit'

Test #53:

score: 0
Accepted
time: 72ms
memory: 12568kb

input:

498556835561 412089307169

output:

no credit

result:

ok single line: 'no credit'

Test #54:

score: 0
Accepted
time: 85ms
memory: 12416kb

input:

602312422583 602312422583

output:

no credit

result:

ok single line: 'no credit'

Test #55:

score: 0
Accepted
time: 70ms
memory: 13956kb

input:

517277 424820460851

output:

no credit

result:

ok single line: 'no credit'