CODE FESTIVAL 2016 Grand Final

Submission #4130372

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define br cout<<endl;
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> pii;
const int MAX = 100005;
const int INF = 1e9+7;
const ll LINF = 1e18 + 7;

/***************************************************************************/

int main()
{
    ios::sync_with_stdio(0);
    int n;
    cin>>n;
    ll ar[n+5],ans=0;
    map<int, int>m;
    for(int i=0;i<n;i++)
    {
        ll a,r=0;
        cin>>a;
        ans^=a;
        while(a%2==0)
        {
            r++;
            a=a/2;
        }
        m[r]++;
    }
    ll x=1>>32,f=0,res=0;
    for(int i=32;i>=0;i++)
    {
        if(ans & x)
        {
            if(m[i])
            {
                ans^=1;
            }
            else
            {
                f=1;
                break;
            }
            res++;
        }
    }
    if(f)
    {
        cout<<-1<<endl;
    }
    else
    {
        cout<<res<<endl;
    }
    return 0;
}



Submission

Task問題 C - Cheating Nim
User nameユーザ名 deathaxe
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1358 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

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

./Main.cpp: In function ‘int main()’:
./Main.cpp:41:13: warning: right shift count >= width of type [-Wshift-count-overflow]
ll x=1>>32,f=0,res=0;
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - example0.txt,example1.txt
All 0 / 500 000.txt,001.txt,002.txt,003.txt,004.txt,005.txt,006.txt,007.txt,008.txt,009.txt,010.txt,011.txt,012.txt,013.txt,014.txt,015.txt,016.txt,017.txt,018.txt,019.txt,020.txt,021.txt,022.txt,023.txt,example0.txt,example1.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
000.txt WA
001.txt WA
002.txt AC 12 ms 256 KB
003.txt WA
004.txt WA
005.txt WA
006.txt WA
007.txt WA
008.txt WA
009.txt WA
010.txt WA
011.txt WA
012.txt WA
013.txt WA
014.txt WA
015.txt WA
016.txt WA
017.txt WA
018.txt WA
019.txt WA
020.txt WA
021.txt WA
022.txt WA
023.txt WA
example0.txt WA
example1.txt WA