Submission #937831

# Submission time Handle Problem Language Result Execution time Memory
937831 2024-03-04T15:03:59 Z velislavgarkov Super Dango Maker (JOI22_dango3) C++17
7 / 100
152 ms 1244 KB
#include "dango3.h"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int MAXN=1e4+10;
bool used[MAXN];
void solve(vector <int> a, int n) {
    if (a.size()==n) {
        Answer(a);
        return;
    }
    vector <int> q;
    int ind;
    for (int i=0;i<a.size();i++) {
        q.push_back(a[i]);
        if (Query(q)==1) {
            ind=i;
            break;
        }
    }
    for (int i=0;i<ind;i++) {
        if (q.size()==n) break;
        q.erase(q.begin());
        if (Query(q)==0) q.push_back(a[i]);
    }
    for (int i=0;i<n;i++) used[q[i]]=true;
    vector <int> newa;
    for (int i=0;i<a.size();i++) {
        if (!used[a[i]]) newa.push_back(a[i]);
    }
    Answer(q);
    solve(newa,n);
}
void Solve(int N, int M) {
    int n, m;
    n=N; m=M;
    vector <int> a;
    for (int i=1;i<=n*m;i++) a.push_back(i);
    random_shuffle(a.begin(),a.end());
    solve(a,n);
}

Compilation message

dango3.cpp: In function 'void solve(std::vector<int>, int)':
dango3.cpp:9:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |     if (a.size()==n) {
      |         ~~~~~~~~^~~
dango3.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i=0;i<a.size();i++) {
      |                  ~^~~~~~~~~
dango3.cpp:23:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |         if (q.size()==n) break;
      |             ~~~~~~~~^~~
dango3.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for (int i=0;i<a.size();i++) {
      |                  ~^~~~~~~~~
dango3.cpp:14:9: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   14 |     int ind;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 352 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 3 ms 552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 1116 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 1244 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -