CODE FESTIVAL 2016 Relay (Parallel)

Submission #1357232

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main()
{
    int n;
    scanf(" %d", &n);

    queue<int> que;
    rep(i,1<<n)
    {
        int a;
        scanf(" %d", &a);
        que.push(a);
    }

    while(que.size()>1)
    {
        int x = que.front(); que.pop();
        int y = que.front(); que.pop();

        if(x==y) que.push(x);
        else que.push(abs(x-y));
    }

    printf("%d\n", que.front());
    return 0;
}

Submission

Task問題 C - 硬度フェスティバル / Kode Festival
User nameユーザ名 imulan
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 915 Byte
File nameファイル名
Exec time実行時間 33 ms
Memory usageメモリ使用量 1280 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf(" %d", &n);
^
./Main.cpp:22:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf(" %d", &a);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt
All 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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 33 ms 1280 KB
subtask1_11.txt AC 33 ms 1280 KB
subtask1_12.txt AC 33 ms 1280 KB
subtask1_13.txt AC 33 ms 1280 KB
subtask1_14.txt AC 33 ms 1280 KB
subtask1_15.txt AC 33 ms 1280 KB
subtask1_16.txt AC 33 ms 1280 KB
subtask1_17.txt AC 33 ms 1280 KB
subtask1_18.txt AC 33 ms 1280 KB
subtask1_19.txt AC 33 ms 1280 KB