Submission #693148

#TimeUsernameProblemLanguageResultExecution timeMemory
693148ktkeremWeighting stones (IZhO11_stones)C++17
100 / 100
224 ms13852 KiB
/*#pragma GCC target ("avx2") #pragma GCC optimize ("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/ #include<bits/stdc++.h> //typedef int ll; typedef long long ll; typedef unsigned long long ull; #define llll std::pair<ll , ll> #define pb push_back #define pf push_front #define halo cout << "hello" << std::endl #define fi first #define sec second #define all(a) a.begin() , a.end() const ll limit = 1e18+7; const ll ous = 2e5 + 500; const ll dx[4] = {-1 , 0 , 1 , 0} , dy[4] = {0,1,0,-1}; std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count()); ll nk; struct segt{ std::vector<llll> valt; ll N = 0; ll prebuild(ll n){ N = n; valt.resize(4 * N + 5); return 1; } void upd(ll nt , llll upd , ll a = 1 , ll nl = 0 , ll nr = 0){ if(a== 1){ nr = N-1; } if(nt > nr || nt < nl){ return; } if(nl == nr){ valt[a] = upd; //std::cout << a << " " << nl << " " << nr << " " << valt[a].fi << " " << valt[a].sec << "\n"; return ; } ll md= (nl + nr)/2; //std::cout << nt << "\n"; segt::upd(nt , upd , a*2 , nl , md); segt::upd(nt , upd ,a*2+1,md+1, nr); ll nb = std::max(0ll , valt[a*2].fi - valt[a*2+1].sec); ll ng = valt[a*2+1].sec - (valt[a*2].fi - nb);; valt[a] = {nb + valt[a*2+1].fi , ng + valt[a*2].sec}; //std::cout << a << " " << nl << " " << nr << " " << valt[a].fi << " " << valt[a].sec << "\n"; return; } }; void solve(){ std::cin >> nk; segt a , b; a.prebuild(nk); b.prebuild(nk); for(ll i=0;nk>i;i++){ ll x , y;std::cin >> x >> y; if(y == 1){ a.upd(x-1 , {0 , 1}); //std::cout << "\n"; b.upd(x-1 , {1 , 0}); } else{ b.upd(x-1 , {0 , 1}); //std::cout << "\n"; a.upd(x-1 , {1 , 0}); } /*std::cout << a.valt[1].fi << " " << a.valt[1].sec << "\n"; std::cout << b.valt[1].fi << " " << b.valt[1].sec << "\n";*/ if(a.valt[1].fi == 0){ std::cout << ">\n"; } else if(b.valt[1].fi == 0){ std::cout << "<\n"; } else{ std::cout << "?\n"; } } return;/**/ } signed main(){ //std::ios_base::sync_with_stdio(false);std::cin.tie(NULL); ll t=1; //std::cin >> t; ll o = 1; while(t--){ //std::cout << "Case " << o << ": "; //o++; solve(); } return 0; }/**/

Compilation message (stderr)

stones.cpp:5:78: warning: "/*" within comment [-Wcomment]
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
      |                                                                               
stones.cpp: In function 'int main()':
stones.cpp:88:8: warning: unused variable 'o' [-Wunused-variable]
   88 |     ll o = 1;
      |        ^
#Verdict Execution timeMemoryGrader output
Fetching results...