답안 #572255

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
572255 2022-06-04T07:13:26 Z Noproblem29 Radio (COCI22_radio) C++17
10 / 110
1500 ms 1324 KB
/*

   author:nurlybek-ye-019-2025

   author:nurlybek-ye-019-2025

   author:nurlybek-ye-019-2025

*/
#include <bits/stdc++.h>
// #pragma optimize ("g",on)
// #pragma GCC optimize ("inline")
// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC optimize ("03")
// #pragma comment(linker, "/stack:200000000")
// #pragma warning(disable : 4996)
using namespace std;
const int N=1e6+5;
#define all(x) x.begin(),x.end()
#define bll(x) (x), (x)+m
#define forn(i, n) for(int i=1; i <= (n); ++i)
#define forauto(i, n) for(int (i):(n));
#define scanfor(a, n) for(int i=0;i <(n); ++i)scanf("%lld",a+i)
#define int long long
#define pb push_back
#define NO {cout<<"NO\n";return;}
#define YES {cout<<"YES\n";return;}
#define sc(x) scanf("%lld",&x)
const int mod=1e9+7;
//⠺⠓⠕⠀⠉⠕⠏⠽⠀⠓⠊⠎⠀⠇⠕⠭
const long double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;
// int n,m,q;
// int p[N];
// int r[N];
// struct query{
//     int w;
//     int a;
//     int b;
//     int i;  
// };
// bool comp(query a,query b){
//     if(a.w==b.w){
//         return a.i<b.i;
//     }
//     return a.w>b.w;
// }
// int find(int x){
//     if(x==p[x]){
//         return x;
//     }
//     return p[x]=find(p[x]);
// }
// void uni(int x,int y){
//     x=find(x);
//     y=find(y);
//     if(x==y)return;
//     if(r[x]>r[y]){
//         swap(x,y);
//     }
//     r[y]+=r[x];
//     p[x]=y;
// }


// int ans[N*3];
int n,q;
bitset<N> bit;
string finds(int l,int r){
    for(int i=bit._Find_next(l-1);i<=r;i=bit._Find_next(i)){
        for(int j=bit._Find_next(i);j<=r;j=bit._Find_next(j)){
            if(i!=j&&gcd(i,j)!=1){
                return "DA";
            }
        }
    }
    return "NE";
}
void Press_Shift_CMD_B(){
    cin>>n>>q;
    for(char s;q--;){
        cin>>s;
        if(s=='S'){
            int x;
            cin>>x;
            bit[x]=1-bit[x];
        }
        else{
            int l,r;
            cin>>l>>r;
            cout<<finds(l,r)<<endl;
        
        }
    }
}
signed main(){
    int t2=1;
    // cin>>t2;
    while(t2--)Press_Shift_CMD_B();
    return 0;
}
/*

   author:nurlybek-ye-019-2025

   author:nurlybek-ye-019-2025
   
   author:nurlybek-ye-019-2025

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1536 ms 1324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Execution timed out 1536 ms 1324 KB Time limit exceeded
9 Halted 0 ms 0 KB -