Submission #509808

# Submission time Handle Problem Language Result Execution time Memory
509808 2022-01-14T10:25:08 Z leinad2 Chameleon's Love (JOI20_chameleon) C++17
4 / 100
19 ms 336 KB
#include "chameleon.h"
#include<bits/stdc++.h>
using namespace std;
void Solve(int N)
{
    vector<int>v;
    for(int i=1;i<=2*N;i++)
    {
        if(v.size()==0)v.push_back(i);
        else
        {
            int a=0, b=v.size();
            while(a<b)
            {
                int m=a+b>>1;
                vector<int>Q;
                for(int j=0;j<=m;j++)Q.push_back(v[j]);
                Q.push_back(i);
                if(Query(Q)==m+1)b=m;
                else a=m+1;
            }
            if(a==v.size())
            {
                v.push_back(i);
                continue;
            }
            vector<int>V;
            for(int j=0;j<a;j++)V.push_back(v[j]);
            for(int j=a+1;j<v.size();j++)V.push_back(v[j]);
            Answer(v[a], i);
            v=V;
        }
    }
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:15:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   15 |                 int m=a+b>>1;
      |                       ~^~
chameleon.cpp:22:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             if(a==v.size())
      |                ~^~~~~~~~~~
chameleon.cpp:29:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             for(int j=a+1;j<v.size();j++)V.push_back(v[j]);
      |                           ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 284 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 17 ms 304 KB Output is correct
4 Correct 16 ms 304 KB Output is correct
5 Correct 18 ms 336 KB Output is correct
6 Correct 15 ms 200 KB Output is correct
7 Correct 17 ms 284 KB Output is correct
8 Correct 15 ms 200 KB Output is correct
9 Correct 19 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Incorrect 1 ms 284 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Incorrect 1 ms 284 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Incorrect 0 ms 200 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 284 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 17 ms 304 KB Output is correct
4 Correct 16 ms 304 KB Output is correct
5 Correct 18 ms 336 KB Output is correct
6 Correct 15 ms 200 KB Output is correct
7 Correct 17 ms 284 KB Output is correct
8 Correct 15 ms 200 KB Output is correct
9 Correct 19 ms 304 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Incorrect 1 ms 284 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -