Submission #894500

#TimeUsernameProblemLanguageResultExecution timeMemory
894500zeta7532Collider (IZhO11_collider)C++17
100 / 100
73 ms3592 KiB
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; const ll mod = 998244353; #define fi first #define se second #define rep(i,n) for(ll i=0;i<n;i++) #define all(x) x.begin(),x.end() #define faster ios::sync_with_stdio(false);cin.tie(nullptr) const ll sq=1000; int main() { ll N,M; cin >> N >> M; string s; cin >> s; ll cnt=(N+sq-1)/sq; vector<string> t(cnt); rep(i,M){ if(i%sq==0){ if(i>0){ s.clear(); rep(j,cnt) s+=t[j],t[j].clear(); } rep(j,N) t[j/sq]+=s[j]; } char c; cin >> c; if(c=='a'){ ll x,y; cin >> x >> y; x--,y--; char p; rep(j,cnt){ if(x<t[j].size()){ p=t[j][x]; t[j].erase(t[j].begin()+x); break; } x-=t[j].size(); } rep(j,cnt){ if(y<=t[j].size()){ t[j].insert(t[j].begin()+y,p); break; } y-=t[j].size(); } } if(c=='q'){ ll x; cin >> x; x--; rep(j,cnt){ if(x<t[j].size()){ cout << t[j][x] << endl; break; } x-=t[j].size(); } } } return 0; }

Compilation message (stderr)

collider.cpp: In function 'int main()':
collider.cpp:39:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |                 if(x<t[j].size()){
      |                    ~^~~~~~~~~~~~
collider.cpp:47:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |                 if(y<=t[j].size()){
      |                    ~^~~~~~~~~~~~~
collider.cpp:59:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |                 if(x<t[j].size()){
      |                    ~^~~~~~~~~~~~
collider.cpp:48:49: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
   48 |                     t[j].insert(t[j].begin()+y,p);
      |                                                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...