QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#954305#4923. 整数gan1234Compile Error//C++141015b2025-03-28 17:18:572025-03-28 17:18:57

Judging History

This is the latest submission verdict.

  • [2025-03-28 17:18:57]
  • Judged
  • [2025-03-28 17:18:57]
  • Submitted

answer

#include "integer.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>p,res;
int val[5005],book[5005];
vector<int> findPermutation(int n){
    for(int i=0;n>i;i++)p.push_back(i);
    shuffle(p.begin(),p.end());
    for(int i=0;n>i;i++)operate(i);
    int lst=n,sum=n;
    for(int i=0;n>i;i++){
        int t=operate(p[i]);
        sum-=(lst+1-t);
        if((lst-t+1))val[p[i]]=sum;
        lst=t;
    }
    int l=0;
    for(int i=0;n>i;i++)
        if(val[p[i]])l=p[i];
    while(1){
        int lst=operate(l),sum=lst;
        int flg=0;
        memset(book,0,sizeof(book));
        for(int i=0;n>i;i++){
            if(val[p[i]])continue;
            flg=1;book[p[i]]=1;
            int t=operate(p[i]);
            sum-=(lst+1-t);
            if((lst-t+1))val[p[i]]=sum;
            lst=t;   
        }
        if(!flg)break;
        for(int i=0;n>i;i++)
            if(!book[i])operate(i);
    }
    for(int i=0;n>i;i++)res.push_back(val[i]);
    return res;    
}

Details

implementer.cpp: In function ‘void integer_grader_F0F01B59EA9BF23E::generateToken()’:
implementer.cpp:19:57: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘std::mersenne_twister_engine<long unsigned int, 64, 312, 156, 31, 13043109905998158313, 29, 6148914691236517205, 17, 8202884508482404352, 37, 18444473444759240704, 43, 6364136223846793005>::result_type’ {aka ‘long unsigned int’} [-Wformat=]
   19 |                 for(int i = 1; i <= 40; i++) printf("%llX", (rng() & 15));
      |                                                      ~~~^   ~~~~~~~~~~~~
      |                                                         |          |
      |                                                         |          std::mersenne_twister_engine<long unsigned int, 64, 312, 156, 31, 13043109905998158313, 29, 6148914691236517205, 17, 8202884508482404352, 37, 18444473444759240704, 43, 6364136223846793005>::result_type {aka long unsigned int}
      |                                                         long long unsigned int
      |                                                      %lX
implementer.cpp: In function ‘void integer_grader_F0F01B59EA9BF23E::main()’:
implementer.cpp:47:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   47 |                 scanf("%d", &n);
      |                 ~~~~~^~~~~~~~~~
implementer.cpp:49:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   49 |                         scanf("%d", p + i);
      |                         ~~~~~^~~~~~~~~~~~~
answer.code: In function ‘std::vector<int> findPermutation(int)’:
answer.code:8:12: error: no matching function for call to ‘shuffle(std::vector<int>::iterator, std::vector<int>::iterator)’
    8 |     shuffle(p.begin(),p.end());
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from answer.code:2:
/usr/include/c++/14/bits/stl_algo.h:3696:5: note: candidate: ‘template<class _RAIter, class _UGenerator> void std::shuffle(_RAIter, _RAIter, _UGenerator&&)’
 3696 |     shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:3696:5: note:   candidate expects 3 arguments, 2 provided