Submission #572299

# Submission time Handle Problem Language Result Execution time Memory
572299 2022-06-04T08:19:15 Z Noproblem29 Radio (COCI22_radio) C++17
40 / 110
1500 ms 884 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){
    if(l==1)l++;
    set<int> ss;
    for(int i=bit._Find_next(l-1);i<=r;i=bit._Find_next(i)){
        if(i%2==0){
            ss.insert(i);
        }
        for(int j=bit._Find_next(i);j<=r;j=bit._Find_next(j)){
            if(j%2==0){
                ss.insert(j);
            }
            if(ss.size()>1||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(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    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
 
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 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
# Verdict Execution time Memory Grader output
1 Correct 25 ms 348 KB Output is correct
2 Correct 34 ms 404 KB Output is correct
3 Correct 35 ms 472 KB Output is correct
4 Correct 78 ms 340 KB Output is correct
5 Correct 455 ms 340 KB Output is correct
6 Correct 1293 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 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 Correct 25 ms 348 KB Output is correct
9 Correct 34 ms 404 KB Output is correct
10 Correct 35 ms 472 KB Output is correct
11 Correct 78 ms 340 KB Output is correct
12 Correct 455 ms 340 KB Output is correct
13 Correct 1293 ms 340 KB Output is correct
14 Correct 44 ms 436 KB Output is correct
15 Correct 48 ms 444 KB Output is correct
16 Correct 50 ms 672 KB Output is correct
17 Correct 123 ms 884 KB Output is correct
18 Correct 85 ms 848 KB Output is correct
19 Correct 85 ms 856 KB Output is correct
20 Correct 1301 ms 748 KB Output is correct
21 Execution timed out 1581 ms 724 KB Time limit exceeded
22 Halted 0 ms 0 KB -