Submission #830492

# Submission time Handle Problem Language Result Execution time Memory
830492 2023-08-19T07:15:22 Z Amylopectin Prize (CEOI22_prize) C++14
0 / 100
311 ms 102420 KB
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <vector>
using namespace std;
const int mxn = 2e6 + 10,mxm = 2e6 + 10;
vector<int> pat[2][mxn] = {};
int par[2][mxn] = {},he[2] = {},retva,retbn,retan,le[2] = {},ri[2] = {}
,up[2][25][mxn] = {},ju[2][25][mxn] = {},u[mxn] = {},las[2],ans[2];
// int re(int v,int cn,int ro)
// {
//     int i,j,fn,can = -1,cbn = -1,cva = 0,of = 0;
//     if(u[cn] == 1)
//     {
//         can = cn;
//         cbn = cn;
//         cva = 0;
//     }
//     for(i=0; i<pat[v][cn].size(); i++)
//     {
//         fn = pat[v][cn][i];
//         re(v,fn,ro);
//         if(retan != -1)
//         {
//             if(can == -1)
//             {
//                 can = retan;
//                 cbn = retbn;
//                 cva = retva;
//             }
//             else 
//             {
//                 of = 1;
//                 if(ro == 0)
//                 {
//                     printf("? %d %d\n",can,retan);
//                 }
//                 else 
//                 {
//                     scanf("%d %d %d %d",&le[0],&ri[0],&le[1],&ri[1]);
//                     ju[v][0][cbn] = cn;
//                     ju[v][0][retbn] = cn;
//                     las[v] = cn;
//                     up[v][0][cbn] = le[v] - cva;
//                     up[v][0][retbn] = ri[v] - retva;
//                 }
//             }
//         }
//     }
//     if(of == 1)
//     {
//         retan = can;
//         retva = cva + up[v][0][cbn];
//         retbn = cn;
//     }
//     else 
//     {
//         retan = can;
//         retva = cva;
//         retbn = cbn;
//     }
//     return 0;
// }
int main()
{
    int i,j,n,m,q,t,cn,cm,fn,fm,k;
    scanf("%d %d %d %d",&n,&m,&q,&t);
    for(i=0; i<2; i++)
    {
        for(j=1; j<=n; j++)
        {
            scanf("%d",&par[i][j]);
            // if(par[i][j] == -1)
            // {
            //     he[i] = j;
            // }
            // else 
            // {
            //     pat[i][par[i][j]].push_back(j);
            // }
        }
    }
    for(i=1; i<=m; i++)
    {
        printf("%d ",i);
        u[i] = 1;
    }
    printf("\n");
    for(i=0; i<q; i++)
    {
        printf("? %d %d\n",1,1);
    }
    // las[0] = 0;
    // las[1] = 0;
    // re(0,he[0],0);
    // re(1,he[1],0);
    printf("!\n");
    fflush(stdout);
    for(i=0; i<q; i++)
    {
        scanf("%d %d %d %d",&cn,&cm,&fn,&fm);
    }
    // re(0,he[0],1);
    // re(1,he[1],1);
    // ju[0][0][las[0]] = -1;
    // ju[1][0][las[1]] = -1;
    // for(i=0; i<22; i++)
    // {
    //     for(j=1; j<=n; j++)
    //     {
    //         for(k=0; k<2; k++)
    //         {
    //             if(ju[k][i][j] == -1)
    //             {
    //                 ju[k][i+1][j] = -1;
    //                 up[k][i+1][j] = -1;
    //             } 
    //             else 
    //             {
    //                 ju[k][i+1][j] = ju[k][i][ju[k][i][j]];
    //                 up[k][i+1][j] = up[k][i][ju[k][i][j]] + up[k][i][j];
    //             }
    //         }
    //     }
    // }
    for(i=0; i<t; i++)
    {
        scanf("%d %d",&cn,&cm);
        // for(k=0; k<2; k++)
        // {
        //     ans[k] = 0;
        //     fn = cn;
        //     fm = cm;
        //     for(j=20; j>=0; j--)
        //     {
        //         if(ju[k][j][fn] != ju[k][j][fm])
        //         {
        //             ans[k] += up[k][j][fn] + up[k][j][fm];
        //             fn = ju[k][j][fn];
        //             fm = ju[k][j][fm];
        //         }
        //     }
        //     ans[k] += up[k][0][fn] + up[k][0][fm];
        // }
        printf("%d %d\n",ans[0],ans[1]);
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:67:33: warning: unused variable 'k' [-Wunused-variable]
   67 |     int i,j,n,m,q,t,cn,cm,fn,fm,k;
      |                                 ^
Main.cpp:68:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   68 |     scanf("%d %d %d %d",&n,&m,&q,&t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:73:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   73 |             scanf("%d",&par[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:102:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  102 |         scanf("%d %d %d %d",&cn,&cm,&fn,&fm);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:129:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  129 |         scanf("%d %d",&cn,&cm);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 139 ms 98400 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 176 ms 98500 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 129 ms 98156 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 311 ms 102028 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 225 ms 102420 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -