Submission #282219

# Submission time Handle Problem Language Result Execution time Memory
282219 2020-08-24T07:04:55 Z 임성재(#5755) None (JOI15_memory) C++17
0 / 100
3366 ms 283756 KB
#include "Memory_lib.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9 + 7;
const ll INF = 1e18;

int Memory(int N, int M) {
  if(N & 1) return -2;

  int h = M % N;
  M /= N;
  int p = M % N + 1;
  M /= N;
  int cnt = M % (N/2 + 1);
  M /= N / 2 + 1;
  int c = M % 5;

  char x = Get(p);
  if(x == '<') x = 1;
  if(x == '>') x = 2;
  if(x == '[') x = 3;
  if(x == ']') x = 4;

  if(cnt == h && (x % 2 == 1)) {
    c = x;
  }
  
  if(x == 1 || x == 3) cnt++;
  else cnt--;

  if(cnt < 0) return -2;

  if(cnt == h && (x % 2 == 0)) {
    if(c != x-1) {
      return -2;
    }
  }

  p++;
  if(p > N) {
    p = 1;
    h++;
    cnt = 0;
  }

  if(h >= N/2+1) {
    return -1;
  }

  int ret = 0;
  ret += c;
  ret *= N/2 + 1;
  ret += cnt;
  ret *= N;
  ret += p-1;
  ret *= N;
  ret += h;

  return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 2862 ms 283680 KB Output is correct
2 Incorrect 3366 ms 283756 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2862 ms 283680 KB Output is correct
2 Incorrect 3366 ms 283756 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2862 ms 283680 KB Output is correct
2 Incorrect 3366 ms 283756 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2862 ms 283680 KB Output is correct
2 Incorrect 3366 ms 283756 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3146 ms 283700 KB Wrong Answer [6]
# Verdict Execution time Memory Grader output
1 Correct 2862 ms 283680 KB Output is correct
2 Incorrect 3366 ms 283756 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -