# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
95423 |
2019-02-01T04:55:52 Z |
Retro3014 |
None (JOI15_memory) |
C++17 |
|
2099 ms |
276768 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
2054 ms |
276372 KB |
Output is correct |
2 |
Correct |
1992 ms |
276724 KB |
Output is correct |
3 |
Incorrect |
2056 ms |
276768 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2054 ms |
276372 KB |
Output is correct |
2 |
Correct |
1992 ms |
276724 KB |
Output is correct |
3 |
Incorrect |
2056 ms |
276768 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2054 ms |
276372 KB |
Output is correct |
2 |
Correct |
1992 ms |
276724 KB |
Output is correct |
3 |
Incorrect |
2056 ms |
276768 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2054 ms |
276372 KB |
Output is correct |
2 |
Correct |
1992 ms |
276724 KB |
Output is correct |
3 |
Incorrect |
2056 ms |
276768 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2099 ms |
276708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2054 ms |
276372 KB |
Output is correct |
2 |
Correct |
1992 ms |
276724 KB |
Output is correct |
3 |
Incorrect |
2056 ms |
276768 KB |
Wrong Answer [6] |