QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#946381#4923. 整数lrx___Compile Error//C++20712b2025-03-21 20:34:032025-03-21 20:34:03

Judging History

This is the latest submission verdict.

  • [2025-03-21 20:34:03]
  • Judged
  • [2025-03-21 20:34:03]
  • Submitted

answer

#include <iostream>
#include <algorithm>
#include <random>
#include <numeric>
#include <vector>
#include <chrono>
#include "integer.h"

std::vector<int> findPermutation(int n) {
	int lst, now, i, j, cnt(0);
	std::vector<signed char> done(n, 0);
	std::vector<int> a(n),p(n);
	std::mt19937 eng(std::chrono::system_clock::now().time_since_epoch().count());
	for (i = 0; i < n; ++i) {
		operate(i);
	}
	lst = n;
	std::iota(a.begin(), a.end(), 1);
	while (cnt < n) {
		std::shuffle(a.begin(), a.end(), eng);
		for (i = 0; i < n; ++i) {
			if (!done[a[i]]) {
				now = operate(a[i]);
				if (now != lst + 1) {
					++cnt;
					p[a[i]] = n - lst + now;
					done[a[i]] = 1;
				}
				lst = now;
			}
		}
	}
	return 0;
}

詳細信息

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:33:16: error: could not convert ‘0’ from ‘int’ to ‘std::vector<int>’
   33 |         return 0;
      |                ^
      |                |
      |                int