QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#210451#5364. 面国漫步shiyihang0 0ms3532kbC++147.2kb2023-10-11 14:42:232023-10-11 14:42:24

Judging History

你现在查看的是最新测评结果

  • [2023-10-11 14:42:24]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3532kb
  • [2023-10-11 14:42:23]
  • 提交

answer

// You know I'm not Alone...
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#define STANDING_IO // 当需要文件输入输出时,注释这一行
#define NO_DEBUG_INFO // 当需要调试信息时,注释这一行
// clang-format off
class fastIO{private:char ibuf[50007],*p1=ibuf,*p2=ibuf,obuf[50007],*p3=obuf,sta[50];bool file_end=false;char get(){return p1==p2&&(p2=(p1=ibuf)+fread(ibuf,1,50007,stdin),p1==p2)?(file_end=true),char(EOF):*p1++;}void put(const char x){p3-obuf<50007?*p3++=x:(fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=x);}public:explicit operator bool(){return!file_end;}size_t flush(){size_t f=fwrite(obuf,p3-obuf,1,stdout);p3=obuf;*p3=0;return f;}fastIO&operator>>(char&t){for(t=get();!isgraph(t);t=get()){;}return*this;}template<typename any>typename std::enable_if<std::is_same<any,char>::value,any>::type tpval(){char t;for(t=get();!isgraph(t);t=get()){;}return t;}fastIO&operator>>(char*t){char c;for(c=get();!isgraph(c);c=get()){;}for(;isgraph(c);c=get())*t=c,t++;*t=0;return*this;}fastIO&operator>>(std::string&t){t.clear();char c;for(c=get();!isgraph(c);c=get()){;}for(;isgraph(c);c=get())t+=c;return*this;}template<typename any>typename std::enable_if<std::is_same<any,std::string>::value,any>::type tpval(){std::string t;char c;for(c=get();!isgraph(c);c=get()){;}for(;isgraph(c);c=get())t+=c;return t;}template<typename any>typename std::enable_if<(std::is_signed<any>::value&&std::is_integral<any>::value&&!std::is_same<any,char>::value)||std::is_same<any,__int128_t>::value,fastIO>::type&operator>>(any&t){t=0;bool y=0;char c=get();for(;!isdigit(c);c=get())if(c==45)y=true;for(;isdigit(c);c=get())t=t*10+c-48;if(y==1)t=-t;return*this;}template<typename any>typename std::enable_if<(std::is_signed<any>::value&&std::is_integral<any>::value&&!std::is_same<any,char>::value)||std::is_same<any,__int128_t>::value,any>::type tpval(){any t=0;bool y=0;char c=get();for(;!isdigit(c);c=get())if(c==45)y=true;for(;isdigit(c);c=get())t=t*10+c-48;if(y==1)t=-t;return t;}template<typename any>typename std::enable_if<(std::is_unsigned<any>::value&&std::is_integral<any>::value&&!std::is_same<any,char>::value)||std::is_same<any,__uint128_t>::value,fastIO>::type&operator>>(any&t){t=0;char c=get();for(;!isdigit(c);c=get()){;}for(;isdigit(c);c=get())t=t*10+c-48;return*this;}template<typename any>typename std::enable_if<(std::is_unsigned<any>::value&&std::is_integral<any>::value&&!std::is_same<any,char>::value)||std::is_same<any,__uint128_t>::value,any>::type tpval(){any t=0;char c=get();for(;!isdigit(c);c=get()){;}for(;isdigit(c);c=get())t=t*10+c-48;return t;}template<typename any1,typename any2>fastIO&operator>>(std::pair<any1,any2>&t){return*this>>t.first>>t.second;}template<typename any1,typename any2>std::pair<any1,any2>tpval(){return std::pair<any1,any2>(tpval<any1>(),tpval<any2>());}template<typename any>fastIO&read(any&t){return*this>>t;}fastIO&read(char*t){char c;for(c=get();!isgraph(c);c=get()){;}for(;isgraph(c);c=get())*t=c,t++;*t=0;return*this;}template<typename any,typename...args>fastIO&read(any&t1,args&...t2){return(*this>>t1).read(t2...);}fastIO&operator<<(const char t){put(t);return*this;}fastIO&operator<<(const char*t){for(;*t;t++)put(*t);return*this;}fastIO&operator<<(const std::string&t){for(const char it:t)put(it);return*this;}template<typename any>typename std::enable_if<(std::is_signed<any>::value&&std::is_integral<any>::value&&!std::is_same<any,char>::value)||std::is_same<any,__int128_t>::value,fastIO>::type&operator<<(any t){if(!t){put(48);return*this;}int len=0;if(t<0)t=-t,put(45);while(t)sta[len++]=char(t%10+48),t/=10;while(len--)put(sta[len]);return*this;}template<typename any>typename std::enable_if<(std::is_unsigned<any>::value&&std::is_integral<any>::value&&!std::is_same<any,char>::value)||std::is_same<any,__uint128_t>::value,fastIO>::type&operator<<(any t){if(!t){put(48);return*this;}int len=0;while(t)sta[len++]=char(t%10+48),t/=10;while(len--)put(sta[len]);return*this;}template<typename any1,typename any2>fastIO&operator<<(const std::pair<any1,any2>&t){return*this<<t.first<<' '<<t.second;}template<typename any>fastIO&write(const any&t){return*this<<t;}template<typename any,typename...args>fastIO&write(const any&t1,const args&...t2){return(*this<<t1).write(t2...);}~fastIO(){fwrite(obuf,p3-obuf,1,stdout);}}fio; /* NOLINT */
#ifndef STANDING_IO
#ifdef _WIN32
#define FILENAME []() -> string { const std::string tmp(__FILE__); const std::size_t pos = tmp.find_last_of('\\') + 1; return tmp.substr(pos, tmp.find_first_of('.') - pos);}()
#else
#define FILENAME []() -> string { const std::string tmp(__FILE__); const std::size_t pos = tmp.find_last_of('/') + 1; return tmp.substr(pos, tmp.find_first_of('.') - pos);}()
#endif
#define INPUT_FILENAME (std::string(FILENAME) + ".in").c_str()
#define OUTPUT_FILENAME (std::string(FILENAME) + ".out").c_str()
#endif
#ifndef NO_DEBUG_INFO
template <typename T> inline void debugValueOutput(const char *format, T t) {std::cerr << "\e[96m" << format << "\e[0m" << '=' << "\e[97;1m" << t << "\e[0m\n";}template <class First, class... Rest>inline void debugValueOutput(const char *format, First first, Rest... rest) { std::cerr << "\e[96m"; while (*format != ',') {std::cerr << *format++;}std::cerr << "\e[0m" << '=' << "\e[97;1m" << first << "\e[0m,";debugValueOutput(format + 1, rest...);}template <typename T>auto operator<<(std::ostream &os, const std::vector<T> &V) -> std::ostream & {os << "[";for (const auto &vv : V) {os << vv << ",";}os << "]";return os;} // NOLINT
#define PREFIX_DEBUG cerr << "\e[1m" << (__FILE__) << ":" << (__LINE__) << "-(" << __FUNCTION__ << ")-[\e[33mdebug\e[0;1m]: \e[0m" // NOLINT
#define debug(...) PREFIX_DEBUG, debugValueOutput(#__VA_ARGS__, __VA_ARGS__) // NOLINT
#else
#define debug(...)
#endif
#define runOnce(arg) [&]{ static bool flg = false; if (!flg) { arg(); flg = true; }}()
// clang-format on
using namespace std;
long long n;
long long m;
struct node {
	long long x, y, z;
};
auto main() -> int {
#ifndef STANDING_IO
	freopen(INPUT_FILENAME, "r", stdin);
	freopen(OUTPUT_FILENAME, "w", stdout);
#endif
	// Your Code Hare...
	fio >> n >> m;
	vector<long long> a(m + 5);
	vector<long long> lst(n + 5);
	for (long long i = 1; i <= m; i++) {
		fio >> a[i], lst[a[i]] = i;
	}
	vector<long long> ff(m + 5);
	for (long long i = 1; i <= n; i++) {
		ff[lst[i]] = 1;
	}
	if (lst[1] != 1) {
		return fio << "YouAreFake\n", 0;
	}
	vector<long long> dis(n + 5, (1LL << 60));
	vector<long long> vv(n + 5);
	dis[1] = 0;
	vector<node> res;
	for (long long l = 1, r; l < m; l = r + 1) {
		r = l + 1;
		while (ff[r] == 0) {
			r++;
		}
		vector<long long> sum(n + 5);
		for (long long i = l; i <= r; i++) {
			sum[a[i]]++;
			if (sum[a[i]] > 1) {
				return fio << "YouAreFake\n", 0;
			}
		}
		for (long long i = l + 1; i <= r - 1; i++) {
			dis[a[i]]--, vv[a[i]] = (1LL << 60) - dis[a[i]];
			res.push_back({a[l], a[i], dis[a[i]] - dis[a[l]]});
		}
		res.push_back({a[l], a[r], vv[a[l]]});
		dis[a[r]] = dis[a[l]] + vv[a[l]];
		r--;
	}
	fio << "YouAreWrite\n";
	fio << (static_cast<long long>(res.size())) << '\n';
	for (auto x : res) {
		fio << x.x << ' ' << x.y << ' ' << x.z << '\n';
	}
#ifndef STANDING_IO
	fio.flush();
	fclose(stdin);
	fclose(stdout);
#endif
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3532kb

input:

3 1
1

output:

YouAreWrite
0

result:

wrong answer Wrong Answer on the First line of output

Subtask #2:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 3508kb

input:

85 78
1 46 49 66 12 47 36 28 44 17 48 34 5 82 20 40 69 52 75 27 14 43 53 83 33 55 38 77 58 56 76 81 6 84 19 80 67 3 50 25 26 21 29 62 70 22 68 63 74 37 7 73 78 42 32 2 64 8 39 71 59 18 23 24 9 51 85 11 57 41 45 16 54 30 35 61 72 4

output:

YouAreWrite
77
1 46 0
46 49 0
49 66 0
66 12 0
12 47 0
47 36 0
36 28 0
28 44 0
44 17 0
17 48 0
48 34 0
34 5 0
5 82 0
82 20 0
20 40 0
40 69 0
69 52 0
52 75 0
75 27 0
27 14 0
14 43 0
43 53 0
53 83 0
83 33 0
33 55 0
55 38 0
38 77 0
77 58 0
58 56 0
56 76 0
76 81 0
81 6 0
6 84 0
84 19 0
19 80 0
80 67 0
67...

result:

wrong answer Wrong Answer on the First line of output

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%