Submission #95423

#TimeUsernameProblemLanguageResultExecution timeMemory
95423Retro3014기억 압축 (JOI15_memory)C++17
10 / 100
2099 ms276768 KiB
#include "Memory_lib.h" #include <iostream> #include <algorithm> #include <vector> #include <stdio.h> using namespace std; int Memory(int N, int M) { //cout<<N<<" "<<M<<endl; int idx = (M>>14); int a = (M>>7)%(1<<7); int b = M%(1<<7); //cout<<idx<<" "<<a<<" "<<b<<endl; if(idx==0){ idx++; int K = (idx<<14) + (a<<7) + b; //cout<<idx<<" "<<a<<" "<<b<<endl; return K; } if(idx==N+1){ if(a==0 && b==0){ return -1; }return -2; } if(idx>N+1){ return -2; } //cout<<idx<<endl; char c = Get(idx); //cout<<c<<endl; if(c=='<'){ a++; }else if(c=='>'){ a--; if(a<0) return -2; }else if(c=='['){ b++; }else if(c==']'){ b--; if(b<0) return -2; }else{ return -2; } idx++; int K = (idx<<14) + (a<<7) + b; //cout<<idx<<" "<<a<<" "<<b<<endl; return K; }
#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...