Submission #555266

#TimeUsernameProblemLanguageResultExecution timeMemory
555266computerboxRadio (COCI22_radio)C++14
Compilation error
0 ms0 KiB
/* ID: computerbox --> Huseyn Hajiyev LANG: C++ TASK: target_mode_on */ #include <bits/stdc++.h> //#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#define _CRT_SECURE_NO_WARNINGS //#include <boost/multiprecision/cpp_int.hpp> //using boost::multiprecision::cpp_int; #define FAST_READ ios_base::sync_with_stdio(0); #define in freopen("input.txt", "r", stdin); #define out freopen("output.txt", "w", stdout); #define ll long long #define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl; #define deb(x)cout<<"#x = "<<(x)<<endl; #define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define endl "\n" #define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n"; #define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n"; #define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl #define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl; #define MAXN 400010 using namespace std; struct segment { vector<pair<int, int> >primes; }; segment t[4 * 1000010]; int used[1000010]; void mergee(int v1, int v2, int v3) { int l = 0; int r = 0; t[v3].clear(); while(l < (int)t[v1].primes.size() && r < (int)t[v2].primes.size()) { if(t[v1].primes[l].first < t[v2].primes[r].first) { t[v3].primes.pb(t[v1].primes[l]); l++; } else if(t[v1].primes[l].first == t[v2].primes[r].first) { t[v3].primes.pb({t[v1].primes[l].first, t[v1].primes[l].second + t[v2].primes[r].second}); l++; r++; } else { t[v3].primes.pb(t[v2].primes[r]); r++; } } while(l < (int)t[v1].primes.size()) { t[v3].primes.pb(t[v1].primes[l]); l++; } while(r < (int)t[v2].primes.size()) { t[v3].primes.pb(t[v2].primes[r]); r++; } } vector<int>primes; vector<pair<int, int> >primes1[1000010]; void update(int v, int l, int r, int pos) { if(l == r) { if(!t[v].primes.empty()) { t[v].primes.clear(); return ; } for(auto i: primes1[l]) { t[v].primes.pb(i); } return ; } int mid = l + (r - l) / 2; if(pos <= mid)update(v * 2, l, mid, pos); else update(v * 2 + 1, mid + 1, r, pos); mergee(v * 2, v * 2 + 1, v); } segment mergee1(segment &one, segment &two) { segment three; int l = 0; int r = 0; while(l < (int)one.primes.size() && r < (int)two.primes.size()) { if(one.primes[l].first < two.primes[r].first) { three.primes.pb(one.primes[l]); l++; } else if(one.primes[l].first == two.primes[r].first) { three.primes.pb({one.primes[l].first, one.primes[l].second + two.primes[r].second}); l++; r++; } else { three.primes.pb(two.primes[r]); r++; } } while(l < (int)one.primes.size()) { three.primes.pb(one.primes[l]); l++; } while(r < (int)two.primes.size()) { three.primes.pb(two.primes[r]); r++; } return three; } segment query(int v, int l, int r, int nac, int konec) { if(l > konec || r < nac) { segment x; return x; } if(l >= nac && r <= konec)return t[v]; int mid = l + (r - l)/ 2; segment one = query(v * 2, l ,mid, nac, konec); segment two = query(v * 2 + 1, mid + 1, r, nac, konec); return mergee1(one, two); } int main(){ FAST_READ; cin.tie(0); cout.tie(0); for(int i = 2; i <= 1000000; i++) { if(used[i])continue; primes1[i].pb({i, 1}); for(long long j = i * 2; j <= 1000000; j += i) { used[j] = 1; primes1[j].pb({i, 1}); } } int n, q; cin >> n >> q; while(q--) { char c; cin >> c; if(c == 'S') { int x; cin >> x; update(1, 1, n, x); } else { int x, y; cin >> x >> y; segment res = query(1, 1, n, x, y); int sig = 0; for(auto i: res.primes) { if(i.second > 1){ sig = 1; break;} } if(!sig)cout << "NE" << endl; else cout << "DA" << endl; } } return 0; }

Compilation message (stderr)

Main.cpp: In function 'void mergee(int, int, int)':
Main.cpp:47:9: error: 'struct segment' has no member named 'clear'
   47 |   t[v3].clear();
      |         ^~~~~