Submission #1000531

# Submission time Handle Problem Language Result Execution time Memory
1000531 2024-06-17T16:37:20 Z edogawa_something Super Dango Maker (JOI22_dango3) C++17
22 / 100
1697 ms 764 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vii;
typedef pair<ll,ll> pii;
#define F first 
#define S second 
#define all(v) v.begin(),v.end()
#define pb push_back
ll n,m;
vector<vii>ans;
bool vis[100000];
bool viss[5001];
ll query(vii &v){
  vii q;
  memset(viss,1,sizeof viss);
  for(int i=0;i<v.size();i++){
    viss[v[i]]&=vis[i];
  }
  for(int i=1;i<=n*m;i++){
    if(viss[i])
    q.pb(i);
  }
  return Query(q);
}
void s(ll x,vii v){
  for(int i=0;i<v.size();i++)
  vis[i]=1;
  if(x==1){
  ans.pb(v);
  return;
  }
  vii vl,vr;
  ll cnt=0;
  ll last=m;
  for(int i=0;i<v.size();i++){
    if(cnt==x/2){
      vis[i]=0;
      ll res=query(v);
      if(res==m-2)
      vl.pb(v[i]);
      else
      vr.pb(v[i]);
      vis[i]=1;
      continue;
    }
    vl.pb(v[i]);
    vis[i]=0;
    ll res=query(v);
    if(res<last&&i>0)
    vis[i]=1;
    else
    cnt++,last=res;
  }
  s(x/2,vl),s((x+1)/2,vr);
}
void Solve(int N, int M) {
  n=N,m=M;
  vii v;
  for(int i=1;i<=n*m;i++)
  v.pb(i);
  s(n,v);
  v.clear();
  for(int i=0;i<m;i++){
    v.clear();
    for(auto it:ans)
    v.pb(it[i]);
    Answer(v);
  }
}

Compilation message

dango3.cpp: In function 'll query(vii&)':
dango3.cpp:18:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int i=0;i<v.size();i++){
      |               ~^~~~~~~~~
dango3.cpp: In function 'void s(ll, vii)':
dango3.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for(int i=0;i<v.size();i++)
      |               ~^~~~~~~~~
dango3.cpp:37:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for(int i=0;i<v.size();i++){
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 348 KB Output is correct
2 Correct 28 ms 348 KB Output is correct
3 Correct 33 ms 524 KB Output is correct
4 Correct 23 ms 344 KB Output is correct
5 Correct 23 ms 344 KB Output is correct
6 Correct 23 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 993 ms 600 KB Output is correct
2 Correct 968 ms 740 KB Output is correct
3 Correct 1002 ms 632 KB Output is correct
4 Correct 1055 ms 648 KB Output is correct
5 Correct 997 ms 600 KB Output is correct
6 Correct 901 ms 624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1697 ms 764 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -