답안 #241539

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
241539 2020-06-24T11:51:15 Z osaaateiasavtnl Broken Device (JOI17_broken_device) C++14
41 / 100
52 ms 3584 KB
#include "Annalib.h"
#include<bits/stdc++.h>

using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC

void Anna( int N, long long X, int K, int P[] ){
    vector <bool> used(N);
    for (int i = 0; i < K; ++i)
        used[P[i]] = 1;
    vector <int> can;
    for (int i = 0; i < N; ++i)
        if (!used[i])   
            can.app(i);

    /*
    cout << "can : ";
    for (auto e : can)  
        cout << e << ' ';
    cout << endl;
    */

    int ptr = 0;
    vector <bool> ans(N);
    for (int bit = 0; bit < 60; ++bit) {
        int w = (X >> bit) & 1;
        while (ptr < can.size() && (can[ptr]&1) != w) {
            ++ptr;
        }   

        if (ptr == can.size()) {
            for (int i = 0; i < N; ++i) 
                Set(i, 0);
            return;
        }   

        ans[can[ptr]] = 1;
        ++ptr;
    }   
    for (int i = 0; i < N; ++i) {
        Set(i, ans[i]);
    }   
}
#include "Brunolib.h"
#include<bits/stdc++.h>

using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC

long long Bruno( int N, int A[] ){
    vector <int> pos;
    for (int i = 0; i < N; ++i)
        if (A[i])
            pos.app(i);

    /*
    cout << "pos : ";
    for (auto e : pos)
        cout << e << ' ';
    cout << endl;
    */

    long long ans = 0;
    for (int i = 0; i < pos.size(); ++i) {
        if (pos[i]&1) {
            ans += 1ll << i;
        }   
    }       
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:35:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while (ptr < can.size() && (can[ptr]&1) != w) {
                ~~~~^~~~~~~~~~~~
Anna.cpp:39:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (ptr == can.size()) {
             ~~~~^~~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:29:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < pos.size(); ++i) {
                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 48 ms 3328 KB Output is partially correct - L* = 30
2 Partially correct 49 ms 3328 KB Output is partially correct - L* = 17
3 Partially correct 48 ms 3312 KB Output is partially correct - L* = 16
4 Partially correct 48 ms 3328 KB Output is partially correct - L* = 18
5 Partially correct 48 ms 3328 KB Output is partially correct - L* = 24
6 Partially correct 47 ms 3328 KB Output is partially correct - L* = 17
7 Partially correct 49 ms 3328 KB Output is partially correct - L* = 15
8 Partially correct 48 ms 3312 KB Output is partially correct - L* = 29
9 Partially correct 48 ms 3328 KB Output is partially correct - L* = 29
10 Partially correct 48 ms 3312 KB Output is partially correct - L* = 30
11 Partially correct 47 ms 3328 KB Output is partially correct - L* = 20
12 Partially correct 49 ms 3328 KB Output is partially correct - L* = 21
13 Partially correct 48 ms 3328 KB Output is partially correct - L* = 28
14 Partially correct 49 ms 3328 KB Output is partially correct - L* = 19
15 Partially correct 48 ms 3328 KB Output is partially correct - L* = 32
16 Partially correct 48 ms 3328 KB Output is partially correct - L* = 18
17 Partially correct 51 ms 3328 KB Output is partially correct - L* = 17
18 Partially correct 51 ms 3312 KB Output is partially correct - L* = 16
19 Partially correct 48 ms 3328 KB Output is partially correct - L* = 28
20 Partially correct 47 ms 3312 KB Output is partially correct - L* = 21
21 Partially correct 49 ms 3312 KB Output is partially correct - L* = 26
22 Partially correct 48 ms 3328 KB Output is partially correct - L* = 29
23 Partially correct 49 ms 3584 KB Output is partially correct - L* = 26
24 Partially correct 49 ms 3312 KB Output is partially correct - L* = 22
25 Partially correct 49 ms 3328 KB Output is partially correct - L* = 29
26 Partially correct 48 ms 3312 KB Output is partially correct - L* = 23
27 Partially correct 48 ms 3328 KB Output is partially correct - L* = 16
28 Partially correct 48 ms 3280 KB Output is partially correct - L* = 23
29 Partially correct 47 ms 3328 KB Output is partially correct - L* = 15
30 Partially correct 48 ms 3328 KB Output is partially correct - L* = 15
31 Partially correct 50 ms 3328 KB Output is partially correct - L* = 30
32 Partially correct 50 ms 3312 KB Output is partially correct - L* = 21
33 Partially correct 50 ms 3312 KB Output is partially correct - L* = 18
34 Partially correct 49 ms 3312 KB Output is partially correct - L* = 31
35 Partially correct 48 ms 3312 KB Output is partially correct - L* = 15
36 Partially correct 48 ms 3328 KB Output is partially correct - L* = 20
37 Partially correct 48 ms 3312 KB Output is partially correct - L* = 16
38 Partially correct 52 ms 3312 KB Output is partially correct - L* = 30
39 Partially correct 49 ms 3312 KB Output is partially correct - L* = 26
40 Partially correct 48 ms 3328 KB Output is partially correct - L* = 25