답안 #710424

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
710424 2023-03-15T08:32:38 Z Darren0724 Minerals (JOI19_minerals) C++17
40 / 100
30 ms 2680 KB
#include "minerals.h"
//#include "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n;
vector<int> v;
void dc(vector<int> &a,vector<int> &c){
    //cout<<a.size()<<' '<<c.size()<<endl;
    if(a.size()==1){
        v[a[0]]=c[0];
        return;
    }
    int t=0;
    int m=a.size()/2;
    for(int i=0;i<m;i++){
        t=Query(a[i]);
    }
    vector<int> c1,c2;
    for(int i:c){
        int t1=Query(i);
        if(t1!=t){
            Query(i);
            c2.push_back(i);
        }
        else{
            c1.push_back(i);
        }
    }
    for(int i:c1){
        Query(i);
    }
    for(int i=0;i<m;i++){
        t=Query(a[i]);
    }
    vector<int> a1,a2;
    for(int i=0;i<m;i++){
        a1.push_back(a[i]);
    }
    for(int i=m;i<a.size();i++){
        a2.push_back(a[i]);
    }
    dc(a1,c1);
    dc(a2,c2);
}
void Solve(int N) {
    n=N;
    vector<int> a;
    vector<int> c;
    int t=0;
    for(int i=1;i<=N*2;i++){
        int t1=Query(i);
        if(t1!=t){
            a.push_back(i);
            t++;
        }
        else{
            c.push_back(i);
            Query(i);
        }
    }
    for(int i:a){
        Query(i);
    }
    v.resize(N*2+1,-1);
    dc(a,c);
    for(int i=1;i<=n*2;i++){
        if(v[i]!=-1)Answer(i,v[i]);
    }
}

Compilation message

minerals.cpp: In function 'void dc(std::vector<int>&, std::vector<int>&)':
minerals.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(int i=m;i<a.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 4 ms 464 KB Output is correct
4 Correct 8 ms 732 KB Output is correct
5 Correct 16 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 8 ms 732 KB Output is correct
9 Correct 16 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 880 KB Output is correct
12 Correct 15 ms 1164 KB Output is correct
13 Correct 13 ms 1232 KB Output is correct
14 Correct 16 ms 1212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 8 ms 732 KB Output is correct
9 Correct 16 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 880 KB Output is correct
12 Correct 15 ms 1164 KB Output is correct
13 Correct 13 ms 1232 KB Output is correct
14 Correct 16 ms 1212 KB Output is correct
15 Incorrect 30 ms 2680 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 8 ms 732 KB Output is correct
9 Correct 16 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 880 KB Output is correct
12 Correct 15 ms 1164 KB Output is correct
13 Correct 13 ms 1232 KB Output is correct
14 Correct 16 ms 1212 KB Output is correct
15 Incorrect 30 ms 2680 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 8 ms 732 KB Output is correct
9 Correct 16 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 880 KB Output is correct
12 Correct 15 ms 1164 KB Output is correct
13 Correct 13 ms 1232 KB Output is correct
14 Correct 16 ms 1212 KB Output is correct
15 Incorrect 30 ms 2680 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 8 ms 732 KB Output is correct
9 Correct 16 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 880 KB Output is correct
12 Correct 15 ms 1164 KB Output is correct
13 Correct 13 ms 1232 KB Output is correct
14 Correct 16 ms 1212 KB Output is correct
15 Incorrect 30 ms 2680 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 8 ms 732 KB Output is correct
9 Correct 16 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 880 KB Output is correct
12 Correct 15 ms 1164 KB Output is correct
13 Correct 13 ms 1232 KB Output is correct
14 Correct 16 ms 1212 KB Output is correct
15 Incorrect 30 ms 2680 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 8 ms 732 KB Output is correct
9 Correct 16 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 880 KB Output is correct
12 Correct 15 ms 1164 KB Output is correct
13 Correct 13 ms 1232 KB Output is correct
14 Correct 16 ms 1212 KB Output is correct
15 Incorrect 30 ms 2680 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -