# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
95428 |
2019-02-01T06:55:58 Z |
Retro3014 |
None (JOI15_memory) |
C++17 |
|
2587 ms |
276892 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 k = (M>>20);
int t = M%(1<<20);
int a = t/10000, b = (t/100)%100, c = (t%100);
if(a>N-1 || b>N-1 || c>N-1) return -2;
char ch = Get(b+1);
//cout<<k<<" "<<a<<" "<<b<<" "<<c<<" "<<ch<<endl;
if(a==0){
if(k==0){
if(ch=='<') k = 1;
else if(ch=='[') k = 2;
}else{
return -2;/*
if(k==1){
if(c!=0 || ch!='>'){
return -2;
}
}else{
if(c!=0 || ch!=']'){
return -2;
}
}
k = 0;
c = 0;*/
}
}
if(k==0){
if(ch=='<' || ch=='['){
a--;
if(a<0) return -2;
}
else{
a++;
}
}
if(k!=0){
if(ch=='<' || ch=='['){
a++;
}
else{
a--;
if(a<0) return -2;
}
if(k==1){
if(ch=='<'){
c++;
}else if(ch=='>'){
c--;
if(c<0) return -2;
}
}else{
if(ch=='['){
c++;
}else if(ch==']'){
c--;
if(c<0) return -2;
}
}
if(a==0 || c==0){
if(a!=0 || c!=0) return -2;
k = 0;
}
}
if(b==N-1){
if(k!=0) return -2;
if(a==N-1) return -1;
b = 0;
a++;
c = 0;
}else{
b++;
}
int K = (k<<20) + a*10000 + b*100 + c;
return K;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2587 ms |
276692 KB |
Output is correct |
2 |
Correct |
2124 ms |
276892 KB |
Output is correct |
3 |
Correct |
2142 ms |
276688 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2587 ms |
276692 KB |
Output is correct |
2 |
Correct |
2124 ms |
276892 KB |
Output is correct |
3 |
Correct |
2142 ms |
276688 KB |
Output is correct |
4 |
Incorrect |
2133 ms |
276812 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2587 ms |
276692 KB |
Output is correct |
2 |
Correct |
2124 ms |
276892 KB |
Output is correct |
3 |
Correct |
2142 ms |
276688 KB |
Output is correct |
4 |
Incorrect |
2133 ms |
276812 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2587 ms |
276692 KB |
Output is correct |
2 |
Correct |
2124 ms |
276892 KB |
Output is correct |
3 |
Correct |
2142 ms |
276688 KB |
Output is correct |
4 |
Incorrect |
2133 ms |
276812 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2310 ms |
276508 KB |
Wrong Answer [6] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2587 ms |
276692 KB |
Output is correct |
2 |
Correct |
2124 ms |
276892 KB |
Output is correct |
3 |
Correct |
2142 ms |
276688 KB |
Output is correct |
4 |
Incorrect |
2133 ms |
276812 KB |
Wrong Answer [6] |