Submission #2143056


Source Code Expand

// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 18;
int n , a[1 << N];

int main(){
  scanf("%d",&n);
  rep(i,0,1<<n) scanf("%d",a+i);
  per(i,0,n) {
    rep(j,0,1<<i) {
      int x=a[j<<1],y=a[j<<1|1];
      if(x>y) a[j]=x-y;
      else if(x==y) a[j]=x;
      else a[j]=y-x;
    }
  }
  printf("%d\n",a[0]);
  return 0;
}

Submission Info

Submission Time
Task C - Kode Festival
User Y_UME
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1084 Byte
Status AC
Exec Time 40 ms
Memory 1280 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:41:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
                 ^
./Main.cpp:42:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   rep(i,0,1<<n) scanf("%d",a+i);
                                ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 23
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All sample_01.txt, sample_02.txt, sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask1_01.txt AC 1 ms 256 KB
subtask1_02.txt AC 1 ms 256 KB
subtask1_03.txt AC 1 ms 256 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 3 ms 256 KB
subtask1_06.txt AC 1 ms 256 KB
subtask1_07.txt AC 5 ms 384 KB
subtask1_08.txt AC 17 ms 768 KB
subtask1_09.txt AC 1 ms 256 KB
subtask1_10.txt AC 32 ms 1280 KB
subtask1_11.txt AC 32 ms 1280 KB
subtask1_12.txt AC 32 ms 1280 KB
subtask1_13.txt AC 40 ms 1280 KB
subtask1_14.txt AC 32 ms 1280 KB
subtask1_15.txt AC 32 ms 1280 KB
subtask1_16.txt AC 32 ms 1280 KB
subtask1_17.txt AC 32 ms 1280 KB
subtask1_18.txt AC 32 ms 1280 KB
subtask1_19.txt AC 32 ms 1280 KB