Submission #56880

# Submission time Handle Problem Language Result Execution time Memory
56880 2018-07-13T04:51:55 Z 노영훈(#1634) None (JOI15_memory) C++11
10 / 100
2983 ms 277012 KB
#include "Memory_lib.h"
#include <iostream>
using namespace std;

int Memory(int n, int m) {
    int cnt1=0, cnt2=0, pos=0;
    
    cnt1=m%(1<<7); m/=(1<<7);
    cnt2=m%(1<<7); m/=(1<<7);
    pos=m;

    // cout<<cnt1<<' '<<cnt2<<' '<<pos<<'\n';

    if(pos>=n){
        return (pos==n && cnt1==0 && cnt2==0) ? -1 : -2;
    }

    // if(pos+1<=0 || n<pos+1) cout<<pos<<' '<<n<<"\n";
    char c=Get(++pos);

    if(c=='<') cnt1++;
    if(c=='>') cnt1--;
    if(c=='[') cnt2++;
    if(c==']') cnt2--;

    if(cnt1<0 || cnt2<0) return -2;

    m=(pos<<14) + (cnt2<<7) + cnt1;

    return m;
}
# Verdict Execution time Memory Grader output
1 Correct 2830 ms 276664 KB Output is correct
2 Correct 2719 ms 276684 KB Output is correct
3 Incorrect 2983 ms 276896 KB Wrong Answer [6]
# Verdict Execution time Memory Grader output
1 Correct 2830 ms 276664 KB Output is correct
2 Correct 2719 ms 276684 KB Output is correct
3 Incorrect 2983 ms 276896 KB Wrong Answer [6]
# Verdict Execution time Memory Grader output
1 Correct 2830 ms 276664 KB Output is correct
2 Correct 2719 ms 276684 KB Output is correct
3 Incorrect 2983 ms 276896 KB Wrong Answer [6]
# Verdict Execution time Memory Grader output
1 Correct 2830 ms 276664 KB Output is correct
2 Correct 2719 ms 276684 KB Output is correct
3 Incorrect 2983 ms 276896 KB Wrong Answer [6]
# Verdict Execution time Memory Grader output
1 Correct 2807 ms 277012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2830 ms 276664 KB Output is correct
2 Correct 2719 ms 276684 KB Output is correct
3 Incorrect 2983 ms 276896 KB Wrong Answer [6]