Submission #993374

# Submission time Handle Problem Language Result Execution time Memory
993374 2024-06-05T14:19:14 Z yellowtoad Super Dango Maker (JOI22_dango3) C++17
22 / 100
151 ms 780 KB
#include "dango3.h"
#include <iostream>
#include <vector>
using namespace std;
 
namespace {
 
vector<int> cur, tmp, ans, v, q;
bool b[10010];
 
}  // namespace
 
void Solve(int n, int m) {
  for (int i = 1; i <= n*m; i++) cur.push_back(i);
  for (int _ = 1; _ <= m; _++) {
    v.clear();
    for (int i = 0; i < cur.size(); i += m) {
      while (1) {
        q = v;
        /*for (int j = 0; j < v.size(); j++) cout << v[j] << " ";
        cout << " v" << endl;*/
        for (int j = i+m; j < cur.size(); j++) if (!b[cur[j]]) q.push_back(cur[j]);
        /*for (int j = 0; j < q.size(); j++) cout << q[j] << " ";
        cout << " gay" << endl;*/
        if (Query(q)) break;
        tmp.clear();
        for (int j = i; j < i+m; j++) if (!b[cur[j]]) tmp.push_back(cur[j]);
        int l = 0, r = (int)tmp.size()-1;
        while (l < r) {
          int mid = (l+r)/2;
          q = v;
          for (int j = mid+1; j < tmp.size(); j++) q.push_back(tmp[j]);
          for (int j = i+m; j < cur.size(); j++) if (!b[cur[j]]) q.push_back(cur[j]);
          if (Query(q)) l = mid+1;
          else r = mid;
        }
        b[tmp[l]] = 1;
        v.push_back(tmp[l]);
      }
    }
    tmp.clear();
    for (int i = 0; i < cur.size(); i++) if (!b[cur[i]]) tmp.push_back(cur[i]);
    if (v.size() > n) cout << 1/0 << endl;
    Answer(v);
    cur = tmp;
  }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int i = 0; i < cur.size(); i += m) {
      |                     ~~^~~~~~~~~~~~
dango3.cpp:22:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for (int j = i+m; j < cur.size(); j++) if (!b[cur[j]]) q.push_back(cur[j]);
      |                           ~~^~~~~~~~~~~~
dango3.cpp:32:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |           for (int j = mid+1; j < tmp.size(); j++) q.push_back(tmp[j]);
      |                               ~~^~~~~~~~~~~~
dango3.cpp:33:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |           for (int j = i+m; j < cur.size(); j++) if (!b[cur[j]]) q.push_back(cur[j]);
      |                             ~~^~~~~~~~~~~~
dango3.cpp:42:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for (int i = 0; i < cur.size(); i++) if (!b[cur[i]]) tmp.push_back(cur[i]);
      |                     ~~^~~~~~~~~~~~
dango3.cpp:43:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |     if (v.size() > n) cout << 1/0 << endl;
      |         ~~~~~~~~~^~~
dango3.cpp:43:32: warning: division by zero [-Wdiv-by-zero]
   43 |     if (v.size() > n) cout << 1/0 << endl;
      |                               ~^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 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 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 604 KB Output is correct
2 Correct 42 ms 636 KB Output is correct
3 Correct 125 ms 604 KB Output is correct
4 Correct 126 ms 604 KB Output is correct
5 Correct 30 ms 600 KB Output is correct
6 Correct 34 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 151 ms 780 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -