Submission #73489966


Source Code Expand

#include<bits/stdc++.h>
#include"atcoder/all"
using namespace std;
using namespace atcoder;
#define int long
int inf = 2000000000000000000;
signed main(){
    int m,a,b;cin>>m>>a>>b;
    int ans=0;
    for(int x=0;x<m;x++){
        for(int y=0;y<m;y++){
            int s1=x;
            int s2=y;
            int s3;
            bool c=true;
            if(s1%m!=0 && s2%m!=0){
                for(int i=0;i<700;i++){
                    s3=a*s2+b*s1;
                    if(s3%m==0){
                        c=false;
                        break;
                    }
                    s1=s2%m;
                    s2=s3%m;
                }
                if(c){
                    ans++;
                }
            }
        }
    }
    cout<<ans<<"\n";
}

Submission Info

Submission Time
Task E - Multiple-Free Sequences
User Sabakanmelm
Language C++23 (GCC 15.2.0)
Score 0
Code Size 800 Byte
Status TLE
Exec Time > 2000 ms
Memory 3672 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 450
Status
AC × 2
TLE × 1
AC × 12
TLE × 24
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 1 ms 3524 KiB
00-sample-02.txt AC 442 ms 3528 KiB
00-sample-03.txt TLE > 2000 ms 3252 KiB
01-01.txt AC 1 ms 3420 KiB
01-02.txt AC 1 ms 3528 KiB
01-03.txt AC 1 ms 3604 KiB
01-04.txt AC 1 ms 3592 KiB
01-05.txt AC 6 ms 3640 KiB
01-06.txt TLE > 2000 ms 3300 KiB
01-07.txt TLE > 2000 ms 3120 KiB
01-08.txt TLE > 2000 ms 3376 KiB
01-09.txt TLE > 2000 ms 3268 KiB
01-10.txt TLE > 2000 ms 3376 KiB
01-11.txt TLE > 2000 ms 3232 KiB
01-12.txt TLE > 2000 ms 3284 KiB
01-13.txt AC 10 ms 3372 KiB
01-14.txt TLE > 2000 ms 3300 KiB
01-15.txt TLE > 2000 ms 3244 KiB
01-16.txt TLE > 2000 ms 3360 KiB
01-17.txt AC 9 ms 3596 KiB
01-18.txt AC 1561 ms 3416 KiB
01-19.txt TLE > 2000 ms 3420 KiB
01-20.txt TLE > 2000 ms 3604 KiB
01-21.txt TLE > 2000 ms 3664 KiB
01-22.txt TLE > 2000 ms 3220 KiB
01-23.txt TLE > 2000 ms 3300 KiB
01-24.txt TLE > 2000 ms 3368 KiB
01-25.txt TLE > 2000 ms 3368 KiB
01-26.txt AC 1434 ms 3672 KiB
01-27.txt TLE > 2000 ms 3300 KiB
01-28.txt TLE > 2000 ms 3264 KiB
01-29.txt AC 1165 ms 3596 KiB
01-30.txt TLE > 2000 ms 3268 KiB
01-31.txt TLE > 2000 ms 3308 KiB
01-32.txt TLE > 2000 ms 3220 KiB
01-33.txt TLE > 2000 ms 3308 KiB