Submission #592371

#TimeUsernameProblemLanguageResultExecution timeMemory
592371errorgorn기억 압축 (JOI15_memory)C++17
10 / 100
2351 ms284296 KiB
#include "Memory_lib.h" #include <bits/stdc++.h> using namespace std; #define int long long #define ii pair<int,int> #define fi first #define se second #define puf push_front #define pof pop_front #define pub push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--) #define all(x) (x).begin(),(x).end() #define sz(x) (int) (x).size() mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); signed Memory(signed n, signed m){ if (n%2==1) return -2; int curr=m&127; int d=(m>>7)&127; int pos=(m>>14)&127; int typ=m>>21; if (curr>=n || d>=n || pos>=n) return -2; char c=Get(pos+1); int nd=d; if (c=='<' || c=='[') nd++; else nd--; int ntyp=0; if (c=='[' || c==']') ntyp=1; if (nd<0) return -2; int typ2; if (nd==d+1){ if (d==curr) typ2=ntyp; } else{ if (nd==curr){ if (typ!=ntyp) return -2; } } if (pos!=n-1){ return curr|(nd<<7)|((pos+1)<<14)|(typ2<<21); } else if (curr!=n-1){ if (nd!=0) return -2; return curr+1; } else{ return -1; } }

Compilation message (stderr)

memory.cpp: In function 'int Memory(int, int)':
memory.cpp:56:42: warning: 'typ2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   56 |   return curr|(nd<<7)|((pos+1)<<14)|(typ2<<21);
      |                                     ~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...