답안 #947089

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
947089 2024-03-15T13:44:17 Z onepunchac168 Minerals (JOI19_minerals) C++14
40 / 100
1000 ms 6540 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

int tmp=0;
bool query(int x)
{
    int rr=Query(x);
    bool ok;
    if (rr!=tmp)
    {
        ok=false;
    }
    else ok=true;
    tmp=rr;
    return ok;
}
void solve(vector <int> left,vector <int> right,bool check)
{
    if (left.size()==1&&right.size()==1)
    {
        cerr<<left[0]<<" "<<right[0]<<" ok"<<endl;
        Answer(left[0],right[0]);
        return;
    }
    int mid=left.size()/2;
    cerr<<left.size()<<" "<<right.size()<<endl;
    if (check==1)
    {
        for (int i=mid;i<=left.size()-1;i++)
        {
            query(left[i]);
        }
    }
    else
    {
        for (int i=0;i<mid;i++)
        {
            query(left[i]);
        }
    }
    vector<int> lefta,leftb,righta,rightb;
    for (auto v:right)
    {
        if (righta.size()==mid)
        {
            rightb.pb(v);
        }
        else if (rightb.size()==right.size()-mid)
        {
            righta.pb(v);
        }
        else if (query(v)==true)
        {
            righta.pb(v);
        }
        else rightb.pb(v);
    }
    for (int i=0;i<mid;i++)
    {
        lefta.pb(left[i]);
    }
    for (int i=mid;i<left.size();i++)
    {
        leftb.pb(left[i]);
    }
    for (auto v:righta)
    {
        cerr<<v<<endl;
    }
    cerr<<lefta[0]<<" "<<mid<<" "<<lefta.size()<<" "<<leftb.size()<<" "<<righta.size()<<" "<<rightb.size()<<'\n';
    solve(lefta,righta,1);
    cerr<<leftb.size()<<" "<<rightb.size()<<" ==="<<endl;
    solve(leftb,rightb,0);
}
void Solve(int n)
{
    vector <int > opt;
    vector <int> left,right;
    for (int i=1;i<=2*n;i++)
    {
        if (query(i)==false)
        {
            left.pb(i);
        }
        else right.pb(i);
    }
    solve(left,right,1);
}

Compilation message

minerals.cpp: In function 'void solve(std::vector<int>, std::vector<int>, bool)':
minerals.cpp:32:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for (int i=mid;i<=left.size()-1;i++)
      |                        ~^~~~~~~~~~~~~~~
minerals.cpp:47:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |         if (righta.size()==mid)
      |             ~~~~~~~~~~~~~^~~~~
minerals.cpp:65:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |     for (int i=mid;i<left.size();i++)
      |                    ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 344 KB Output is correct
2 Correct 79 ms 608 KB Output is correct
3 Correct 167 ms 748 KB Output is correct
4 Correct 342 ms 1740 KB Output is correct
5 Correct 652 ms 2692 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 4 ms 344 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
5 Correct 39 ms 344 KB Output is correct
6 Correct 79 ms 608 KB Output is correct
7 Correct 167 ms 748 KB Output is correct
8 Correct 342 ms 1740 KB Output is correct
9 Correct 652 ms 2692 KB Output is correct
10 Correct 38 ms 344 KB Output is correct
11 Correct 447 ms 2136 KB Output is correct
12 Correct 642 ms 2748 KB Output is correct
13 Correct 648 ms 2548 KB Output is correct
14 Correct 666 ms 2684 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 4 ms 344 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
5 Correct 39 ms 344 KB Output is correct
6 Correct 79 ms 608 KB Output is correct
7 Correct 167 ms 748 KB Output is correct
8 Correct 342 ms 1740 KB Output is correct
9 Correct 652 ms 2692 KB Output is correct
10 Correct 38 ms 344 KB Output is correct
11 Correct 447 ms 2136 KB Output is correct
12 Correct 642 ms 2748 KB Output is correct
13 Correct 648 ms 2548 KB Output is correct
14 Correct 666 ms 2684 KB Output is correct
15 Execution timed out 1721 ms 6540 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
5 Correct 39 ms 344 KB Output is correct
6 Correct 79 ms 608 KB Output is correct
7 Correct 167 ms 748 KB Output is correct
8 Correct 342 ms 1740 KB Output is correct
9 Correct 652 ms 2692 KB Output is correct
10 Correct 38 ms 344 KB Output is correct
11 Correct 447 ms 2136 KB Output is correct
12 Correct 642 ms 2748 KB Output is correct
13 Correct 648 ms 2548 KB Output is correct
14 Correct 666 ms 2684 KB Output is correct
15 Execution timed out 1721 ms 6540 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
5 Correct 39 ms 344 KB Output is correct
6 Correct 79 ms 608 KB Output is correct
7 Correct 167 ms 748 KB Output is correct
8 Correct 342 ms 1740 KB Output is correct
9 Correct 652 ms 2692 KB Output is correct
10 Correct 38 ms 344 KB Output is correct
11 Correct 447 ms 2136 KB Output is correct
12 Correct 642 ms 2748 KB Output is correct
13 Correct 648 ms 2548 KB Output is correct
14 Correct 666 ms 2684 KB Output is correct
15 Execution timed out 1721 ms 6540 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
5 Correct 39 ms 344 KB Output is correct
6 Correct 79 ms 608 KB Output is correct
7 Correct 167 ms 748 KB Output is correct
8 Correct 342 ms 1740 KB Output is correct
9 Correct 652 ms 2692 KB Output is correct
10 Correct 38 ms 344 KB Output is correct
11 Correct 447 ms 2136 KB Output is correct
12 Correct 642 ms 2748 KB Output is correct
13 Correct 648 ms 2548 KB Output is correct
14 Correct 666 ms 2684 KB Output is correct
15 Execution timed out 1721 ms 6540 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
5 Correct 39 ms 344 KB Output is correct
6 Correct 79 ms 608 KB Output is correct
7 Correct 167 ms 748 KB Output is correct
8 Correct 342 ms 1740 KB Output is correct
9 Correct 652 ms 2692 KB Output is correct
10 Correct 38 ms 344 KB Output is correct
11 Correct 447 ms 2136 KB Output is correct
12 Correct 642 ms 2748 KB Output is correct
13 Correct 648 ms 2548 KB Output is correct
14 Correct 666 ms 2684 KB Output is correct
15 Execution timed out 1721 ms 6540 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
5 Correct 39 ms 344 KB Output is correct
6 Correct 79 ms 608 KB Output is correct
7 Correct 167 ms 748 KB Output is correct
8 Correct 342 ms 1740 KB Output is correct
9 Correct 652 ms 2692 KB Output is correct
10 Correct 38 ms 344 KB Output is correct
11 Correct 447 ms 2136 KB Output is correct
12 Correct 642 ms 2748 KB Output is correct
13 Correct 648 ms 2548 KB Output is correct
14 Correct 666 ms 2684 KB Output is correct
15 Execution timed out 1721 ms 6540 KB Time limit exceeded
16 Halted 0 ms 0 KB -