답안 #24417

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
24417 2017-06-07T10:56:27 Z Extazy 돌 무게 재기 (IZhO11_stones) C++14
0 / 100
0 ms 18408 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1<<17;
const int G = 32;

struct xorshift {
    unsigned x,y,z,w;
    xorshift(): x(123456789), y(2387329), z(7777777), w(87389) {}
    unsigned next() {
        unsigned t=x^(x<<11);
        x=y;y=z;z=w;
        return w=w^(w>>19)^t^(t>>8);
    }
    unsigned next(unsigned a) {
        return next()%a;
    }
    unsigned next(int a, int b) {
        return a+next(b-a+1);
    }
} rng;

int n,w[G][N];
long long s[2][G];

int main() {
    int i,j,x,y,cnt0,cnt1;

    scanf("%d", &n);
    
    for(i=1;i<=30;i++) {
        map < int, bool > have;
        for(j=1;j<=n;j++) {
            w[i][j]=rng.next(1,1000000000);
            if(have.find(w[i][j])==have.end()) have[w[i][j]]=true;
            else {
                --j;
                continue;
            }
        }
        sort(w[i]+1,w[i]+1+n);
    }
    
    for(i=1;i<=n;i++) {
        scanf("%d %d", &x, &y);
        --y;
        for(j=1;j<=30;j++) s[y][j]+=w[j][x];
        cnt0=cnt1=0;
        for(j=1;j<=30;j++) cnt0+=(s[0][j]>s[1][j]),cnt1+=(s[1][j]>s[0][j]);
        if(cnt0==30) printf(">\n");
        else if(cnt1==30) printf("<\n");
        else printf("?\n");
    }

    return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:30:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
stones.cpp:46:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &x, &y);
                               ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 18408 KB Output isn't correct
2 Halted 0 ms 0 KB -