답안 #1072702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072702 2024-08-24T03:03:47 Z Cyanberry Minerals (JOI19_minerals) C++14
40 / 100
14 ms 2012 KB
// minecraft
#include <bits/stdc++.h>
using namespace std;
#include "minerals.h"
void Solve(int types) {
    bool side[types * 2];
    int sT[types], sF[types], relT[types], relF[types], match[types * 2];
    for (int i=0; i<types * 2; ++i) {
        side[i] = false;
        match[i] = 0;
    }
    int last = 0, sTc = 0, sFc = 0;
    for (int i=0; i<types * 2; ++i) {
        int curr = Query(i+1);
        if (curr > last) {
            ++last;
            sT[sTc] = i+1;
            ++sTc;
            side[i] = true;
        } else {
            sF[sFc] = i+1;
            ++sFc;
        }
    }
    bool inside[types];
    for (int i =0; i < types; ++i) {
        inside[i] = true;
    }
    for (int i = log2(types) + 1; i >= 0; --i) {
        // for (int i : match) {
        //     cerr<<i<<' ';
        // }
        // cerr<<'\n';
        for (int j = 0; j < types; ++j) {
            if (((sT[j] & (1<<i)) > 0) == inside[j]) {
                last = Query(sT[j]);
                inside[j] = !inside[j];
            }
        }
        for (int j =0; j < types; ++j) {
            int curr = Query(sF[j]);
            if (curr != last) {
                match[sF[j]-1] |= (1<<i);
                last = curr;
            }
        }
    }
    for (int i = 0; i <  types * 2; ++i) {
        if (match[i] > 0) {
            Answer(i+1, match[i]);
        }
    }
}

Compilation message

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:6:10: warning: variable 'side' set but not used [-Wunused-but-set-variable]
    6 |     bool side[types * 2];
      |          ^~~~
minerals.cpp:7:31: warning: unused variable 'relT' [-Wunused-variable]
    7 |     int sT[types], sF[types], relT[types], relF[types], match[types * 2];
      |                               ^~~~
minerals.cpp:7:44: warning: unused variable 'relF' [-Wunused-variable]
    7 |     int sT[types], sF[types], relT[types], relF[types], match[types * 2];
      |                                            ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 3 ms 600 KB Output is correct
5 Correct 5 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 5 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 4 ms 856 KB Output is correct
12 Correct 7 ms 1068 KB Output is correct
13 Correct 3 ms 1012 KB Output is correct
14 Correct 5 ms 1020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 5 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 4 ms 856 KB Output is correct
12 Correct 7 ms 1068 KB Output is correct
13 Correct 3 ms 1012 KB Output is correct
14 Correct 5 ms 1020 KB Output is correct
15 Incorrect 14 ms 2012 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 5 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 4 ms 856 KB Output is correct
12 Correct 7 ms 1068 KB Output is correct
13 Correct 3 ms 1012 KB Output is correct
14 Correct 5 ms 1020 KB Output is correct
15 Incorrect 14 ms 2012 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 5 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 4 ms 856 KB Output is correct
12 Correct 7 ms 1068 KB Output is correct
13 Correct 3 ms 1012 KB Output is correct
14 Correct 5 ms 1020 KB Output is correct
15 Incorrect 14 ms 2012 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 5 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 4 ms 856 KB Output is correct
12 Correct 7 ms 1068 KB Output is correct
13 Correct 3 ms 1012 KB Output is correct
14 Correct 5 ms 1020 KB Output is correct
15 Incorrect 14 ms 2012 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 5 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 4 ms 856 KB Output is correct
12 Correct 7 ms 1068 KB Output is correct
13 Correct 3 ms 1012 KB Output is correct
14 Correct 5 ms 1020 KB Output is correct
15 Incorrect 14 ms 2012 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 5 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 4 ms 856 KB Output is correct
12 Correct 7 ms 1068 KB Output is correct
13 Correct 3 ms 1012 KB Output is correct
14 Correct 5 ms 1020 KB Output is correct
15 Incorrect 14 ms 2012 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -