Submission #315116

# Submission time Handle Problem Language Result Execution time Memory
315116 2020-10-22T02:42:32 Z daniel920712 Mouse (info1cup19_mouse) C++14
13 / 100
3000 ms 256 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include "grader.h"

using namespace std;
vector < vector < int > > all;
vector < int > con;
vector < int > how;
int cmp(vector < int > a, vector < int > b)
{
    int i;
    int N=a.size(),con=0;
    for(i=0;i<N;i++) if(a[i]==b[i]) con++;
    return con;
}
void solve(int N)
{
    how.clear();
    int i,now=0,x,ok=1,t=0;
    for(i=0;i<N;i++) how.push_back(i+1);
    while(t!=N)
    {
        for(i=0;i<N;i++) how[i]=i+1;
        do
        {
            ok=1;
            x=0;
            for(auto i:all)
            {
                if(cmp(i,how)!=con[x]) ok=0;
                x++;
            }
            if(ok)
            {
                t=query(how);
                con.push_back(t);
                all.push_back(how);
                break;

            }
        }while(next_permutation(how.begin(),how.end())!=0);
    }


}


Compilation message

mouse.cpp: In function 'void solve(int)':
mouse.cpp:21:11: warning: unused variable 'now' [-Wunused-variable]
   21 |     int i,now=0,x,ok=1,t=0;
      |           ^~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 256 KB Correct! Number of queries: 7
2 Correct 1 ms 256 KB Correct! Number of queries: 4
3 Correct 1 ms 256 KB Correct! Number of queries: 5
4 Correct 8 ms 256 KB Correct! Number of queries: 7
5 Correct 11 ms 256 KB Correct! Number of queries: 8
6 Correct 1 ms 256 KB Correct! Number of queries: 5
# Verdict Execution time Memory Grader output
1 Correct 6 ms 256 KB Correct! Number of queries: 7
2 Correct 1 ms 256 KB Correct! Number of queries: 4
3 Correct 1 ms 256 KB Correct! Number of queries: 5
4 Correct 8 ms 256 KB Correct! Number of queries: 7
5 Correct 11 ms 256 KB Correct! Number of queries: 8
6 Correct 1 ms 256 KB Correct! Number of queries: 5
7 Execution timed out 3079 ms 256 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 256 KB Correct! Number of queries: 7
2 Correct 1 ms 256 KB Correct! Number of queries: 4
3 Correct 1 ms 256 KB Correct! Number of queries: 5
4 Correct 8 ms 256 KB Correct! Number of queries: 7
5 Correct 11 ms 256 KB Correct! Number of queries: 8
6 Correct 1 ms 256 KB Correct! Number of queries: 5
7 Execution timed out 3079 ms 256 KB Time limit exceeded
8 Halted 0 ms 0 KB -