| [ | |
| { | |
| "code_id": 3, | |
| "code": "// Words are flowing out like endless rain into a paper cup\r\n// They slither while they pass they slip away across the universe\r\n// Pools of sorrow, waves of joy are drifting through my open mind\r\n// Possessing and caressing me\r\n\r\n#include <bits/stdc++.h>\r\nusing namespace std;\r\n\r\nusing LL = long long;\r\n\r\nnamespace _buff {\r\n\r\nconst size_t BUFF = 1 << 19;\r\nchar ibuf[BUFF], *ib = ibuf, *ie = ibuf;\r\nchar getc() {\r\n if (ib == ie) {\r\n ib = ibuf;\r\n ie = ibuf + fread(ibuf, 1, BUFF, stdin);\r\n }\r\n return ib == ie ? -1 : *ib++;\r\n}\r\n\r\n}\r\n\r\nLL read() {\r\n using namespace _buff;\r\n LL ret = 0;\r\n bool pos = true;\r\n char c = getc();\r\n for (; (c < '0' || c > '9') && c != '-'; c = getc()) {\r\n assert(~c);\r\n }\r\n if (c == '-') {\r\n pos = false;\r\n c = getc();\r\n }\r\n for (; c >= '0' && c <= '9'; c = getc()) {\r\n ret = (ret << 3) + (ret << 1) + (c ^ 48);\r\n }\r\n return pos ? ret : -ret;\r\n}\r\n\r\nint gcd(int a, int b) {\r\n int t;\r\n while (b) {\r\n t = a % b;\r\n a = b;\r\n b = t;\r\n }\r\n return a;\r\n}\r\n\r\nint main() {\r\n int n = read();\r\n vector<int> a(n); generate_n(begin(a), n, read);\r\n vector<int> q(n); generate_n(begin(q), n, []() { return read() - 1; });\r\n vector<int> ans1(n), ans2(n);\r\n\r\n vector<int> id(n);\r\n iota(begin(id), end(id), 0);\r\n sort(begin(id), end(id), [&](int x, int y) {\r\n return a[x] > a[y];\r\n });\r\n\r\n auto get_inter = [&](int i, int j) {\r\n return (a[i] - a[j]) / (i - j);\r\n };\r\n\r\n auto solve = [&](int fl) {\r\n auto comp = [&](int a, int b) {\r\n return (a < b) ^ fl;\r\n };\r\n vector<int> stk;\r\n for (int i : id) {\r\n while (!stk.empty() && comp(stk.back(), i)) {\r\n stk.pop_back();\r\n }\r\n while (stk.size() > 1 && get_inter(i, *++stk.rbegin()) <= get_inter(i, stk.back())) {\r\n stk.pop_back();\r\n }\r\n stk.emplace_back(i);\r\n if (comp(a[q[i]], a[i]) && comp(q[i], stk.front())) {\r\n int l = 0, r = (int) stk.size() - 1;\r\n while (l < r) {\r\n int mid = (l + 1 + r) >> 1;\r\n if (comp(q[i], stk[mid]) && get_inter(stk[mid - 1], q[i]) > get_inter(stk[mid], q[i])) {\r\n l = mid;\r\n } else {\r\n r = mid - 1;\r\n }\r\n }\r\n ans1[i] = a[stk[l]] - a[q[i]];\r\n ans2[i] = stk[l] - q[i];\r\n }\r\n }\r\n };\r\n solve(0);\r\n reverse(begin(id), end(id));\r\n solve(1);\r\n for (int i = 0; i < n; ++i) {\r\n if (ans2[i]) {\r\n if (ans2[i] < 0) {\r\n ans1[i] *= -1;\r\n ans2[i] *= -1;\r\n }\r\n int g = gcd(ans1[i], ans2[i]);\r\n ans1[i] /= g;\r\n ans2[i] /= g;\r\n printf(\"%d/%d\\n\", ans1[i], ans2[i]);\r\n } else {\r\n puts(\"-1\");\r\n }\r\n }\r\n return 0;\r\n}\r\n", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpzsgny7d5/b766164e-ad89-4634-b783-6d737a526596.cpp: In function ‘int main()’:\n/tmp/tmpzsgny7d5/b766164e-ad89-4634-b783-6d737a526596.cpp:55:33: error: no matching function for call to ‘generate_n(std::vector<int>::iterator, int&, <unresolved overloaded function type>)’\n 55 | vector<int> a(n); generate_n(begin(a), n, read);\n | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~\nIn file included from /usr/include/c++/11/algorithm:62,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,\n from /tmp/tmpzsgny7d5/b766164e-ad89-4634-b783-6d737a526596.cpp:6:\n/usr/include/c++/11/bits/stl_algo.h:4456:5: note: candidate: ‘template<class _OIter, class _Size, class _Generator> _OIter std::generate_n(_OIter, _Size, _Generator)’\n 4456 | generate_n(_OutputIterator __first, _Size __n, _Generator __gen)\n | ^~~~~~~~~~\n/usr/include/c++/11/bits/stl_algo.h:4456:5: note: template argument deduction/substitution failed:\n/tmp/tmpzsgny7d5/b766164e-ad89-4634-b783-6d737a526596.cpp:55:33: note: couldn’t deduce template parameter ‘_Generator’\n 55 | vector<int> a(n); generate_n(begin(a), n, read);\n | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~\nIn file included from /usr/include/c++/11/algorithm:74,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,\n from /tmp/tmpzsgny7d5/b766164e-ad89-4634-b783-6d737a526596.cpp:6:\n/usr/include/c++/11/pstl/glue_algorithm_defs.h:204:1: note: candidate: ‘template<class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Generator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::generate_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Generator)’\n 204 | generate_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size count, _Generator __g);\n | ^~~~~~~~~~\n/usr/include/c++/11/pstl/glue_algorithm_defs.h:204:1: note: template argument deduction/substitution failed:\n/tmp/tmpzsgny7d5/b766164e-ad89-4634-b783-6d737a526596.cpp:55:33: note: candidate expects 4 arguments, 3 provided\n 55 | vector<int> a(n); generate_n(begin(a), n, read);\n | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~\n" | |
| ], | |
| "tcb_id": "Falling Portals" | |
| }, | |
| { | |
| "code_id": 9, | |
| "code": "// #pragma GCC optimize(2)\r\n// #pragma GCC optimize(3)\r\n// #pragma GCC optimize(\"Ofast\")\r\n// #pragma GCC optimize(\"inline\")\r\n// #pragma GCC optimize(\"-fgcse\")\r\n// #pragma GCC optimize(\"-fgcse-lm\")\r\n// #pragma GCC optimize(\"-fipa-sra\")\r\n// #pragma GCC optimize(\"-ftree-pre\")\r\n// #pragma GCC optimize(\"-ftree-vrp\")\r\n// #pragma GCC optimize(\"-fpeephole2\")\r\n// #pragma GCC optimize(\"-ffast-math\")\r\n// #pragma GCC optimize(\"-fsched-spec\")\r\n// #pragma GCC optimize(\"unroll-loops\")\r\n// #pragma GCC optimize(\"-falign-jumps\")\r\n// #pragma GCC optimize(\"-falign-loops\")\r\n// #pragma GCC optimize(\"-falign-labels\")\r\n// #pragma GCC optimize(\"-fdevirtualize\")\r\n// #pragma GCC optimize(\"-fcaller-saves\")\r\n// #pragma GCC optimize(\"-fcrossjumping\")\r\n// #pragma GCC optimize(\"-fthread-jumps\")\r\n// #pragma GCC optimize(\"-funroll-loops\")\r\n// #pragma GCC optimize(\"-fwhole-program\")\r\n// #pragma GCC optimize(\"-freorder-blocks\")\r\n// #pragma GCC optimize(\"-fschedule-insns\")\r\n// #pragma GCC optimize(\"inline-functions\")\r\n// #pragma GCC optimize(\"-ftree-tail-merge\")\r\n// #pragma GCC optimize(\"-fschedule-insns2\")\r\n// #pragma GCC optimize(\"-fstrict-aliasing\")\r\n// #pragma GCC optimize(\"-fstrict-overflow\")\r\n// #pragma GCC optimize(\"-falign-functions\")\r\n// #pragma GCC optimize(\"-fcse-skip-blocks\")\r\n// #pragma GCC optimize(\"-fcse-follow-jumps\")\r\n// #pragma GCC optimize(\"-fsched-interblock\")\r\n// #pragma GCC optimize(\"-fpartial-inlining\")\r\n// #pragma GCC optimize(\"no-stack-protector\")\r\n// #pragma GCC optimize(\"-freorder-functions\")\r\n// #pragma GCC optimize(\"-findirect-inlining\")\r\n// #pragma GCC optimize(\"-fhoist-adjacent-loads\")\r\n// #pragma GCC optimize(\"-frerun-cse-after-loop\")\r\n// #pragma GCC optimize(\"inline-small-functions\")\r\n// #pragma GCC optimize(\"-finline-small-functions\")\r\n// #pragma GCC optimize(\"-ftree-switch-conversion\")\r\n// #pragma GCC optimize(\"-foptimize-sibling-calls\")\r\n// #pragma GCC optimize(\"-fexpensive-optimizations\")\r\n// #pragma GCC optimize(\"-funsafe-loop-optimizations\")\r\n// #pragma GCC optimize(\"inline-functions-called-once\")\r\n// #pragma GCC optimize(\"-fdelete-null-pointer-checks\")\r\n\r\n// #include \"stdio.h\" \r\n\r\nchar outBuf[1 << 22], *outNow = outBuf;\r\ninline void flush () {\r\n // fwrite (outBuf, 1, outNow - outBuf, stdout); \r\n *(++ outNow) = '\\0'; \r\n printf(\"%s\", outBuf); \r\n outNow = outBuf; \r\n}\r\ninline void pc (char ch) {\r\n *(outNow ++) = ch; \r\n if (outNow - outBuf == sizeof(outBuf)) \r\n flush (); \r\n}\r\ninline void print(int x) {\r\n short num[35], *numNow = num; \r\n if (x <= 0) \r\n pc (x? (char)'-': (char)'0'), x = -x; \r\n while (x) \r\n *(numNow ++) = x % 10, x /= 10; \r\n while (numNow != num) \r\n pc ((char)(48 | *(-- numNow))); \r\n}\r\n\r\nchar s[1 << 21];\r\nmain() {\r\n scanf(\"%s\", s);\r\n if (s[0] == 'a' && s[1] == 'a') {\r\n for (int i = 0; s[i]; ++ i) \r\n print(i + 1), pc(32); \r\n flush(); \r\n return 0; \r\n }\r\n int x = 0, y, z;\r\n while (s[x]) {\r\n y = z = x;\r\n while (s[++y] && s[y] >= s[z]) s[y] > s[z] ? z = x : ++z;\r\n while (x <= z) print(x += y - z), pc(32);\r\n }\r\n flush(); \r\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "cc1plus: warning: command-line option ‘-std=c99’ is valid for C/ObjC but not for C++\n/tmp/tmpf6f_ngyi/b8c9a000-aa0b-4f02-bafa-257db61f9f50.cpp: In function ‘void flush()’:\n/tmp/tmpf6f_ngyi/b8c9a000-aa0b-4f02-bafa-257db61f9f50.cpp:55:5: error: ‘printf’ was not declared in this scope\n 55 | printf(\"%s\", outBuf);\n | ^~~~~~\n/tmp/tmpf6f_ngyi/b8c9a000-aa0b-4f02-bafa-257db61f9f50.cpp:1:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?\n +++ |+#include <cstdio>\n 1 | // #pragma GCC optimize(2)\n/tmp/tmpf6f_ngyi/b8c9a000-aa0b-4f02-bafa-257db61f9f50.cpp: At global scope:\n/tmp/tmpf6f_ngyi/b8c9a000-aa0b-4f02-bafa-257db61f9f50.cpp:74:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]\n 74 | main() {\n | ^~~~\n/tmp/tmpf6f_ngyi/b8c9a000-aa0b-4f02-bafa-257db61f9f50.cpp: In function ‘int main()’:\n/tmp/tmpf6f_ngyi/b8c9a000-aa0b-4f02-bafa-257db61f9f50.cpp:75:5: error: ‘scanf’ was not declared in this scope\n 75 | scanf(\"%s\", s);\n | ^~~~~\n" | |
| ], | |
| "tcb_id": "Lyndon 分解" | |
| }, | |
| { | |
| "code_id": 0, | |
| "code": "#include<bits/stdc++.h>\nusing namespace std;\nchar s[1000015];\nint main()\n{\nios::sync_with_stdio(0),cin.tie(0),cout.tie(0);\nwhile(cin>>s+1){\n\tif(s[1]=='.')break;\n\tint next[1000015];\n\tint len=strlen(s+1);\n\tint j=0;\n\tfor(int i=2;i<=len;i++){\n\t\twhile(s[i]!=s[j+1]&&j)j--;\n\t\tif(s[i]==s[j+1])j++;\n\t\tnext[i]=j;\n\t}\n\tcout<<len/(len-next[len])<<'\\n';\n}\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp: In function ‘int main()’:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:10: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)\n 7 | while(cin>>s+1){\n | ~~~^~~~~\n | | |\n | | char*\n | std::istream {aka std::basic_istream<char>}\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:168:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)\n 168 | operator>>(bool& __n)\n | ^~~~~~~~\n/usr/include/c++/11/istream:168:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:172:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)\n 172 | operator>>(short& __n);\n | ^~~~~~~~\n/usr/include/c++/11/istream:172:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive]\n 7 | while(cin>>s+1){\n | ~^~\n | |\n | char*\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind rvalue ‘(short int)(((char*)(& s)) + 1)’ to ‘short int&’\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:175:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)\n 175 | operator>>(unsigned short& __n)\n | ^~~~~~~~\n/usr/include/c++/11/istream:175:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive]\n 7 | while(cin>>s+1){\n | ~^~\n | |\n | char*\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind rvalue ‘(short unsigned int)(((char*)(& s)) + 1)’ to ‘short unsigned int&’\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:179:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)\n 179 | operator>>(int& __n);\n | ^~~~~~~~\n/usr/include/c++/11/istream:179:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive]\n 7 | while(cin>>s+1){\n | ~^~\n | |\n | char*\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind rvalue ‘(int)(((char*)(& s)) + 1)’ to ‘int&’\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:182:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)\n 182 | operator>>(unsigned int& __n)\n | ^~~~~~~~\n/usr/include/c++/11/istream:182:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive]\n 7 | while(cin>>s+1){\n | ~^~\n | |\n | char*\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind rvalue ‘(unsigned int)(((char*)(& s)) + 1)’ to ‘unsigned int&’\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:186:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)\n 186 | operator>>(long& __n)\n | ^~~~~~~~\n/usr/include/c++/11/istream:186:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive]\n 7 | while(cin>>s+1){\n | ~^~\n | |\n | char*\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind rvalue ‘(long int)(((char*)(& s)) + 1)’ to ‘long int&’\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:190:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)\n 190 | operator>>(unsigned long& __n)\n | ^~~~~~~~\n/usr/include/c++/11/istream:190:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive]\n 7 | while(cin>>s+1){\n | ~^~\n | |\n | char*\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& s)) + 1)’ to ‘long unsigned int&’\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:195:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)\n 195 | operator>>(long long& __n)\n | ^~~~~~~~\n/usr/include/c++/11/istream:195:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive]\n 7 | while(cin>>s+1){\n | ~^~\n | |\n | char*\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind rvalue ‘(long long int)(((char*)(& s)) + 1)’ to ‘long long int&’\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:199:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)\n 199 | operator>>(unsigned long long& __n)\n | ^~~~~~~~\n/usr/include/c++/11/istream:199:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive]\n 7 | while(cin>>s+1){\n | ~^~\n | |\n | char*\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& s)) + 1)’ to ‘long long unsigned int&’\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:235:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)\n 235 | operator>>(void*& __p)\n | ^~~~~~~~\n/usr/include/c++/11/istream:235:7: note: conversion of argument 1 would be ill-formed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:120:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’\n 120 | operator>>(__istream_type& (*__pf)(__istream_type&))\n | ^~~~~~~~\n/usr/include/c++/11/istream:120:36: note: no known conversion for argument 1 from ‘char*’ to ‘std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)’ {aka ‘std::basic_istream<char>& (*)(std::basic_istream<char>&)’}\n 120 | operator>>(__istream_type& (*__pf)(__istream_type&))\n | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/istream:124:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]’\n 124 | operator>>(__ios_type& (*__pf)(__ios_type&))\n | ^~~~~~~~\n/usr/include/c++/11/istream:124:32: note: no known conversion for argument 1 from ‘char*’ to ‘std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)’ {aka ‘std::basic_ios<char>& (*)(std::basic_ios<char>&)’}\n 124 | operator>>(__ios_type& (*__pf)(__ios_type&))\n | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/istream:131:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’\n 131 | operator>>(ios_base& (*__pf)(ios_base&))\n | ^~~~~~~~\n/usr/include/c++/11/istream:131:30: note: no known conversion for argument 1 from ‘char*’ to ‘std::ios_base& (*)(std::ios_base&)’\n 131 | operator>>(ios_base& (*__pf)(ios_base&))\n | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~\n/usr/include/c++/11/istream:214:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’\n 214 | operator>>(float& __f)\n | ^~~~~~~~\n/usr/include/c++/11/istream:214:25: note: no known conversion for argument 1 from ‘char*’ to ‘float&’\n 214 | operator>>(float& __f)\n | ~~~~~~~^~~\n/usr/include/c++/11/istream:218:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’\n 218 | operator>>(double& __f)\n | ^~~~~~~~\n/usr/include/c++/11/istream:218:26: note: no known conversion for argument 1 from ‘char*’ to ‘double&’\n 218 | operator>>(double& __f)\n | ~~~~~~~~^~~\n/usr/include/c++/11/istream:222:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’\n 222 | operator>>(long double& __f)\n | ^~~~~~~~\n/usr/include/c++/11/istream:222:31: note: no known conversion for argument 1 from ‘char*’ to ‘long double&’\n 222 | operator>>(long double& __f)\n | ~~~~~~~~~~~~~^~~\n/usr/include/c++/11/istream:259:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]’\n 259 | operator>>(__streambuf_type* __sb);\n | ^~~~~~~~\n/usr/include/c++/11/istream:259:36: note: no known conversion for argument 1 from ‘char*’ to ‘std::basic_istream<char>::__streambuf_type*’ {aka ‘std::basic_streambuf<char>*’}\n 259 | operator>>(__streambuf_type* __sb);\n | ~~~~~~~~~~~~~~~~~~^~~~\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:45,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/cstddef:130:5: note: candidate: ‘template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(std::byte, _IntegerType)’\n 130 | operator>>(byte __b, _IntegerType __shift) noexcept\n | ^~~~~~~~\n/usr/include/c++/11/cstddef:130:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:7: note: cannot convert ‘std::cin’ (type ‘std::istream’ {aka ‘std::basic_istream<char>’}) to type ‘std::byte’\n 7 | while(cin>>s+1){\n | ^~~\nIn file included from /usr/include/c++/11/string:56,\n from /usr/include/c++/11/bits/locale_classes.h:40,\n from /usr/include/c++/11/bits/ios_base.h:41,\n from /usr/include/c++/11/ios:42,\n from /usr/include/c++/11/istream:38,\n from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/basic_string.tcc:1485:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)’\n 1485 | operator>>(basic_istream<_CharT, _Traits>& __in,\n | ^~~~~~~~\n/usr/include/c++/11/bits/basic_string.tcc:1485:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/istream:995,\n from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/istream.tcc:958:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)’\n 958 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)\n | ^~~~~~~~\n/usr/include/c++/11/bits/istream.tcc:958:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘char*’)\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:756:5: note: candidate: ‘template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)’\n 756 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)\n | ^~~~~~~~\n/usr/include/c++/11/istream:756:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: note: cannot convert ‘(((char*)(& s)) + 1)’ (type ‘char*’) to type ‘unsigned char&’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:761:5: note: candidate: ‘template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)’\n 761 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)\n | ^~~~~~~~\n/usr/include/c++/11/istream:761:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: note: cannot convert ‘(((char*)(& s)) + 1)’ (type ‘char*’) to type ‘signed char&’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:838:5: note: candidate: ‘template<class _CharT, class _Traits, long unsigned int _Num> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT (&)[_Num])’\n 838 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT (&__s)[_Num])\n | ^~~~~~~~\n/usr/include/c++/11/istream:838:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘_CharT [_Num]’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:847:5: note: candidate: ‘template<class _Traits, long unsigned int _Num> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char (&)[_Num])’\n 847 | operator>>(basic_istream<char, _Traits>& __in, unsigned char (&__s)[_Num])\n | ^~~~~~~~\n/usr/include/c++/11/istream:847:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘unsigned char [_Num]’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:852:5: note: candidate: ‘template<class _Traits, long unsigned int _Num> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char (&)[_Num])’\n 852 | operator>>(basic_istream<char, _Traits>& __in, signed char (&__s)[_Num])\n | ^~~~~~~~\n/usr/include/c++/11/istream:852:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘signed char [_Num]’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/istream:985:5: note: candidate: ‘template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)’\n 985 | operator>>(_Istream&& __is, _Tp&& __x)\n | ^~~~~~~~\n/usr/include/c++/11/istream:985:5: note: template argument deduction/substitution failed:\n/usr/include/c++/11/istream: In substitution of ‘template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_istream<char>&; _Tp = char*]’:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: required from here\n/usr/include/c++/11/istream:985:5: error: template constraint failure for ‘template<class _Is, class _Tp> requires (__derived_from_ios_base<_Is>) && requires(_Is& __is, _Tp&& __t) {__is >> (forward<_Tp>)(__t);} using __rvalue_stream_extraction_t = _Is&&’\n/usr/include/c++/11/istream:985:5: note: constraints not satisfied\nIn file included from /usr/include/c++/11/istream:39,\n from /usr/include/c++/11/sstream:38,\n from /usr/include/c++/11/complex:45,\n from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/ostream: In substitution of ‘template<class _Is, class _Tp> requires (__derived_from_ios_base<_Is>) && requires(_Is& __is, _Tp&& __t) {__is >> (forward<_Tp>)(__t);} using __rvalue_stream_extraction_t = _Is&& [with _Is = std::basic_istream<char>&; _Tp = char*]’:\n/usr/include/c++/11/istream:985:5: required by substitution of ‘template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_istream<char>&; _Tp = char*]’\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: required from here\n/usr/include/c++/11/ostream:717:13: required for the satisfaction of ‘__derived_from_ios_base<_Is>’ [with _Is = std::basic_istream<char, std::char_traits<char> >&]\n/usr/include/c++/11/ostream:717:39: note: the expression ‘is_class_v<_Tp> [with _Tp = std::basic_istream<char, std::char_traits<char> >&]’ evaluated to ‘false’\n 717 | concept __derived_from_ios_base = is_class_v<_Tp>\n | ^~~~~~~~~~~~~~~\nIn file included from /usr/include/c++/11/ccomplex:39,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/complex:501:5: note: candidate: ‘template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::complex<_Tp>&)’\n 501 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)\n | ^~~~~~~~\n/usr/include/c++/11/complex:501:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::complex<_Tp>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:66,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bitset:1472:5: note: candidate: ‘template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::bitset<_Nb>&)’\n 1472 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)\n | ^~~~~~~~\n/usr/include/c++/11/bitset:1472:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::bitset<_Nb>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:72,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/iomanip:71:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Resetiosflags)’\n 71 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)\n | ^~~~~~~~\n/usr/include/c++/11/iomanip:71:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: note: cannot convert ‘(((char*)(& s)) + 1)’ (type ‘char*’) to type ‘std::_Resetiosflags’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:72,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/iomanip:101:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setiosflags)’\n 101 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)\n | ^~~~~~~~\n/usr/include/c++/11/iomanip:101:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: note: cannot convert ‘(((char*)(& s)) + 1)’ (type ‘char*’) to type ‘std::_Setiosflags’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:72,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/iomanip:132:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setbase)’\n 132 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)\n | ^~~~~~~~\n/usr/include/c++/11/iomanip:132:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: note: cannot convert ‘(((char*)(& s)) + 1)’ (type ‘char*’) to type ‘std::_Setbase’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:72,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/iomanip:170:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setfill<_CharT>)’\n 170 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)\n | ^~~~~~~~\n/usr/include/c++/11/iomanip:170:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::_Setfill<_CharT>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:72,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/iomanip:200:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setprecision)’\n 200 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)\n | ^~~~~~~~\n/usr/include/c++/11/iomanip:200:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: note: cannot convert ‘(((char*)(& s)) + 1)’ (type ‘char*’) to type ‘std::_Setprecision’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:72,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/iomanip:230:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Setw)’\n 230 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)\n | ^~~~~~~~\n/usr/include/c++/11/iomanip:230:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: note: cannot convert ‘(((char*)(& s)) + 1)’ (type ‘char*’) to type ‘std::_Setw’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:72,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/iomanip:264:5: note: candidate: ‘template<class _CharT, class _Traits, class _MoneyT> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Get_money<_MoneyT>)’\n 264 | operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f)\n | ^~~~~~~~\n/usr/include/c++/11/iomanip:264:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::_Get_money<_MoneyT>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:72,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/iomanip:418:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::_Get_time<_CharT>)’\n 418 | operator>>(basic_istream<_CharT, _Traits>& __is, _Get_time<_CharT> __f)\n | ^~~~~~~~\n/usr/include/c++/11/iomanip:418:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::_Get_time<_CharT>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/valarray:603,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: candidate: ‘template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__shift_right, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__shift_right, typename _Dom1::value_type>::result_type> std::operator>>(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)’\n 414 | _DEFINE_EXPR_BINARY_OPERATOR(>>, struct std::__shift_right)\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/valarray:603,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__shift_right, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__shift_right, typename _Dom1::value_type>::result_type> std::operator>>(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)’\n 414 | _DEFINE_EXPR_BINARY_OPERATOR(>>, struct std::__shift_right)\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/valarray:603,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__shift_right, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__shift_right, typename _Dom1::value_type>::result_type> std::operator>>(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)’\n 414 | _DEFINE_EXPR_BINARY_OPERATOR(>>, struct std::__shift_right)\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/valarray:603,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__shift_right, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__shift_right, typename _Dom1::value_type>::result_type> std::operator>>(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)’\n 414 | _DEFINE_EXPR_BINARY_OPERATOR(>>, struct std::__shift_right)\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/valarray:603,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__shift_right, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__shift_right, typename _Dom1::value_type>::result_type> std::operator>>(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)’\n 414 | _DEFINE_EXPR_BINARY_OPERATOR(>>, struct std::__shift_right)\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/bits/valarray_after.h:414:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/valarray:1194:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__shift_right, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__shift_right, _Tp>::result_type> std::operator>>(const std::valarray<_Tp>&, const std::valarray<_Tp>&)’\n 1194 | _DEFINE_BINARY_OPERATOR(>>, __shift_right)\n | ^~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/valarray:1194:1: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::valarray<_Tp>’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/valarray:1194:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__shift_right, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__shift_right, _Tp>::result_type> std::operator>>(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)’\n 1194 | _DEFINE_BINARY_OPERATOR(>>, __shift_right)\n | ^~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/valarray:1194:1: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::valarray<_Tp>’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/valarray:1194:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__shift_right, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__shift_right, _Tp>::result_type> std::operator>>(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)’\n 1194 | _DEFINE_BINARY_OPERATOR(>>, __shift_right)\n | ^~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/c++/11/valarray:1194:1: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘const std::valarray<_Tp>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:921:5: note: candidate: ‘template<class _IntType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::uniform_int_distribution<_IntType>&)’\n 921 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:921:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::uniform_int_distribution<_IntType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:982:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::uniform_real_distribution<_IntType>&)’\n 982 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:982:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::uniform_real_distribution<_IntType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2167:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::cauchy_distribution<_RealType>&)’\n 2167 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2167:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::cauchy_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:49,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.h:3722:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::bernoulli_distribution&)’\n 3722 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.h:3722:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:13: note: cannot convert ‘(((char*)(& s)) + 1)’ (type ‘char*’) to type ‘std::bernoulli_distribution&’\n 7 | while(cin>>s+1){\n | ~^~\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:1124:5: note: candidate: ‘template<class _IntType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::geometric_distribution<_IntType>&)’\n 1124 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:1124:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::geometric_distribution<_IntType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:1775:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::exponential_distribution<_RealType>&)’\n 1775 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:1775:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::exponential_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2561:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::weibull_distribution<_RealType>&)’\n 2561 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2561:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::weibull_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2635:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::extreme_value_distribution<_RealType>&)’\n 2635 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2635:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::extreme_value_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:175:5: note: candidate: ‘template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::linear_congruential_engine<_UIntType, __a, __c, __m>&)’\n 175 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:175:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::linear_congruential_engine<_UIntType, __a, __c, __m>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:501:5: note: candidate: ‘template<class _UIntType1, long unsigned int __w1, long unsigned int __n1, long unsigned int __m1, long unsigned int __r1, _UIntType1 __a1, long unsigned int __u1, _UIntType1 __d1, long unsigned int __s1, _UIntType1 __b1, long unsigned int __t1, _UIntType1 __c1, long unsigned int __l1, _UIntType1 __f1, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>&)’\n 501 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:501:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:652:5: note: candidate: ‘template<class _UIntType, long unsigned int __w, long unsigned int __s, long unsigned int __r, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::subtract_with_carry_engine<_UIntType, __w, __s, __r>&)’\n 652 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:652:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::subtract_with_carry_engine<_UIntType, __w, __s, __r>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:718:5: note: candidate: ‘template<class _RandomNumberEngine, long unsigned int __p, long unsigned int __r, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::discard_block_engine<_RandomNumberEngine, __p, __r>&)’\n 718 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:718:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::discard_block_engine<_RandomNumberEngine, __p, __r>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:881:5: note: candidate: ‘template<class _RandomNumberEngine, long unsigned int __k, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::shuffle_order_engine<_RandomNumberEngine, __k>&)’\n 881 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:881:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::shuffle_order_engine<_RandomNumberEngine, __k>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:1239:5: note: candidate: ‘template<class _IntType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::negative_binomial_distribution<_IntType>&)’\n 1239 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:1239:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::negative_binomial_distribution<_IntType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:1449:5: note: candidate: ‘template<class _IntType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::poisson_distribution<_IntType>&)’\n 1449 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:1449:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::poisson_distribution<_IntType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:1716:5: note: candidate: ‘template<class _IntType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::binomial_distribution<_IntType>&)’\n 1716 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:1716:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::binomial_distribution<_IntType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:1945:5: note: candidate: ‘template<class _RealType1, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::normal_distribution<_RealType>&)’\n 1945 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:1945:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::normal_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2010:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::lognormal_distribution<_RealType>&)’\n 2010 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2010:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::lognormal_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2081:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::chi_squared_distribution<_RealType>&)’\n 2081 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2081:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::chi_squared_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2243:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::fisher_f_distribution<_RealType>&)’\n 2243 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2243:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::fisher_f_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2316:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::student_t_distribution<_RealType>&)’\n 2316 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2316:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::student_t_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2486:5: note: candidate: ‘template<class _RealType1, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::gamma_distribution<_RealType>&)’\n 2486 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2486:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::gamma_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:2794:5: note: candidate: ‘template<class _IntType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::discrete_distribution<_IntType>&)’\n 2794 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:2794:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::discrete_distribution<_IntType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:3001:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::piecewise_constant_distribution<_RealType>&)’\n 3001 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:3001:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::piecewise_constant_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\nIn file included from /usr/include/c++/11/random:51,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,\n from /tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:1:\n/usr/include/c++/11/bits/random.tcc:3207:5: note: candidate: ‘template<class _RealType, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::piecewise_linear_distribution<_RealType>&)’\n 3207 | operator>>(std::basic_istream<_CharT, _Traits>& __is,\n | ^~~~~~~~\n/usr/include/c++/11/bits/random.tcc:3207:5: note: template argument deduction/substitution failed:\n/tmp/tmpq3hv6bco/50828c64-5168-4094-ab25-0ef8cd5e6d90.cpp:7:14: note: mismatched types ‘std::piecewise_linear_distribution<_RealType>’ and ‘char*’\n 7 | while(cin>>s+1){\n | ^\n" | |
| ], | |
| "tcb_id": "Power Strings" | |
| }, | |
| { | |
| "code_id": 4, | |
| "code": "// 给出的条件就是 Hall 定理 |S| <= |N(S)| \r\n#include <bits/stdc++.h>\r\nusing namespace std;\r\n#define ri register int\r\nnamespace io {\r\n\tconst int SIZE = (1 << 21) + 1;\r\n\tchar ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;\r\n\t// getchar\r\n\t#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)\r\n\t// print the remaining part\r\n\tinline void flush () {\r\n\t\tfwrite (obuf, 1, oS - obuf, stdout);\r\n\t\toS = obuf;\r\n\t}\r\n\t// putchar\r\n\tinline void putc (char x) {\r\n\t\t*oS ++ = x;\r\n\t\tif (oS == oT) flush ();\r\n\t}\r\n\t// input a signed integer\r\n\ttemplate <class I>\r\n\tinline void gi (I &x) {\r\n\t\tfor (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;\r\n\t\tfor (x = 0; c <= '9' && c >= '0'; c = gc()) x = (x << 1) + (x << 3) + (c & 15); x *= f;\r\n\t}\r\n\t// print a signed integer\r\n\ttemplate <class I>\r\n\tinline void print (I x) {\r\n\t\tif (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;\r\n\t\twhile (x) qu[++ qr] = x % 10 + '0', x /= 10;\r\n\t\twhile (qr) putc (qu[qr --]);\r\n\t}\r\n\t//no need to call flush at the end manually!\r\n\tstruct Flusher_ {~Flusher_(){flush();}}io_flusher_;\r\n}\r\nusing io :: gi;\r\nusing io :: putc;\r\nusing io :: print;\r\nconst int N=305,M=N*N<<1,inf=2e9;\r\nstruct flow{\r\n\tint tot=1,head[N],nxt[M],adj[M],w[M],dep[N],q[N],cur[N],s,t;\r\n\tinline void addedge(ri x,ri y,ri z){\r\n\t\tnxt[++tot]=head[x];\r\n\t\tadj[head[x]=tot]=y;\r\n\t\tw[tot]=z;\r\n\t}\r\n\tinline void add(ri x,ri y,ri z){\r\n\t\taddedge(x,y,z);\r\n\t\taddedge(y,x,0);\r\n\t}\r\n\tinline bool bfs(){\r\n\t\tri i,l,r,x,y;\r\n\t\tfor(i=s;i<=t;++i) dep[i]=0,cur[i]=head[i];\r\n\t\tdep[s]=1;\r\n\t\tq[l=r=1]=s;\r\n\t\twhile(l<=r){\r\n\t\t\tx=q[l++];\r\n\t\t\tfor(i=head[x];i;i=nxt[i])\r\n\t\t\t\tif(w[i]&&!dep[y=adj[i]])\r\n\t\t\t\t\tq[++r]=y,\r\n\t\t\t\t\tdep[y]=dep[x]+1;\r\n\t\t}\r\n\t\treturn dep[t];\r\n\t}\r\n\tinline int dfs(ri x,ri now){\r\n\t\tif(x==t) return now;\r\n\t\tri y,tmp,res=0;\r\n\t\tfor(int &i=cur[x];i;i=nxt[i])\r\n\t\t\tif(w[i]&&dep[y=adj[i]]==dep[x]+1&&(tmp=dfs(y,min(now,w[i])))){\r\n\t\t\t\tres+=tmp;\r\n\t\t\t\tw[i]-=tmp;\r\n\t\t\t\tw[i^1]+=tmp;\r\n\t\t\t\tif(!(now-=tmp)) return res;\r\n\t\t\t}\r\n\t\treturn res;\r\n\t}\r\n\tinline int maxflow(){\r\n\t\tri res=0;\r\n\t\twhile(bfs())\r\n\t\t\tres+=dfs(s,inf);\r\n\t\treturn res;\r\n\t}\r\n}flow;\r\nvector<int> v[N],r[N];\r\nint rt,vis[N],link[N];\r\ninline bool dfs(ri x){\r\n\tfor(auto o:v[x])\r\n\t\tif(vis[o]!=rt){\r\n\t\t\tvis[o]=rt;\r\n\t\t\tif(!link[o]||dfs(link[o])){\r\n\t\t\t\tlink[o]=x;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\treturn false;\r\n}\r\nbitset<N> e[N];\r\nint p[N];\r\nint main(){\r\n//\tfreopen(\"y.in\",\"r\",stdin);\r\n//\tfreopen(\"y.out\",\"w\",stdout);\r\n\tri n,m,i,j,x,ans;\r\n\tgi(n);\r\n\tfor(i=1;i<=n;++i){\r\n\t\tgi(m);\r\n\t\twhile(m--) gi(x),v[i].push_back(x),r[x].push_back(i);\r\n\t}\r\n\tfor(i=1;i<=n;++i)\r\n\t\trt=i,dfs(i);\r\n\tflow.s=0;\r\n\tflow.t=n+1;\r\n\tfor(i=1;i<=n;++i)\r\n\t\tfor(auto o:r[i])\r\n\t\t\tif(o!=link[i])\r\n\t\t\t\te[o][link[i]]=1;\r\n\tfor(i=1;i<=n;++i)\r\n\t\tfor(j=1;j<=n;++j)\r\n\t\t\tif(e[j][i])\r\n\t\t\t\te[i]|=e[j];\r\n\tans=0;\r\n\tfor(i=1;i<=n;++i) gi(p[i]),p[i]=-p[i];\r\n\tfor(i=1;i<=n;++i){\r\n\t\tx=p[i];\r\n\t\tif(x>0){ \r\n\t\t\tans+=x;\r\n\t\t\tflow.add(flow.s,i,x);\r\n\t\t\tfor(j=e[i]._Find_first();j!=e[i].size();j=e[i]._Find_next(j))\r\n\t\t\t\tif(p[j]<0)\r\n\t\t\t\t\tflow.add(i,j,inf);\r\n\t\t} \r\n\t\telse\r\n\t\t\tflow.add(i,flow.t,-x);\r\n\t}\r\n\tans-=flow.maxflow();\r\n\tprintf(\"%d\\n\",-ans);\r\n\treturn 0;\r\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:85:21: error: ‘int link [305]’ redeclared as different kind of entity\n 85 | int rt,vis[N],link[N];\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,\n from /usr/include/signal.h:328,\n from /usr/include/c++/11/csignal:42,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:43,\n from /tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:2:\n/usr/include/unistd.h:819:12: note: previous declaration ‘int link(const char*, const char*)’\n 819 | extern int link (const char *__from, const char *__to)\n | ^~~~\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp: In function ‘bool dfs(int)’:\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:90:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 90 | if(!link[o]||dfs(link[o])){\n | ^\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:90:48: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 90 | if(!link[o]||dfs(link[o])){\n | ^\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:90:48: error: invalid conversion from ‘int (*)(const char*, const char*) noexcept’ {aka ‘int (*)(const char*, const char*)’} to ‘int’ [-fpermissive]\n 90 | if(!link[o]||dfs(link[o])){\n | ~~~~~~^\n | |\n | int (*)(const char*, const char*) noexcept {aka int (*)(const char*, const char*)}\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:86:20: note: initializing argument 1 of ‘bool dfs(int)’\n 86 | inline bool dfs(ri x){\n | ^\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:91:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 91 | link[o]=x;\n | ^\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:91:40: error: assignment of read-only location ‘*(link + ((sizetype)o))’\n 91 | link[o]=x;\n | ~~~~~~~^~\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp: In function ‘int main()’:\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:114:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 114 | if(o!=link[i])\n | ^\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:114:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]\n 114 | if(o!=link[i])\n | ~^~~~~~~~~\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:115:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 115 | e[o][link[i]]=1;\n | ^\n/tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:115:44: error: invalid conversion from ‘int (*)(const char*, const char*) noexcept’ {aka ‘int (*)(const char*, const char*)’} to ‘std::size_t’ {aka ‘long unsigned int’} [-fpermissive]\n 115 | e[o][link[i]]=1;\n | ~~~~~~^\n | |\n | int (*)(const char*, const char*) noexcept {aka int (*)(const char*, const char*)}\nIn file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:66,\n from /tmp/tmp9eq9v77b/a31e6505-0959-4c30-bb4b-009bd7f25739.cpp:2:\n/usr/include/c++/11/bitset:1163:25: note: initializing argument 1 of ‘std::bitset<_Nb>::reference std::bitset<_Nb>::operator[](std::size_t) [with long unsigned int _Nb = 305; std::size_t = long unsigned int]’\n 1163 | operator[](size_t __position)\n | ~~~~~~~^~~~~~~~~~\n" | |
| ], | |
| "tcb_id": "价" | |
| }, | |
| { | |
| "code_id": 1, | |
| "code": "#include <algorithm>\r\n#include <stdio.h>\r\n#include <time.h>\r\n\r\n#define lowbit(x) ((x) & -(x))\r\n\r\n#ifdef whzzt\r\n#define debug(...) fprintf(stderr, __VA_ARGS__)\r\n#else\r\n#define debug(...) \r\n#endif\r\n\r\ntypedef unsigned long long u64;\r\ntypedef unsigned int u32;\r\ntypedef long long i64;\r\n\r\nusing std::vector;\r\n\r\nu64 count_primes(u64 x){\r\n\t// Deleglise and Rivat (with more space using)\r\n\t\r\n\tif (x <= 1) return 0;\r\n\t\r\n\tconst int eps = 128;\r\n\tconst int eps_bit = 16;\r\n\t\r\n\tu32 S2 = sqrtl(x);\r\n\tu32 S3 = powl(x, 1.0 / 3);\r\n\tu32 S4 = sqrtl(S2);\r\n\tu32 B = std::max(2ull, std::min(u64(S2), u64(S3 * pow(log(x), 3) * 0.0001)));\r\n\tu32 S0 = sqrtl(B);\r\n\tu32 U = x / B + eps;\r\n\t\r\n\tu32 a, b, p, q, t, r, u, v, w0, w1;\r\n\ti64 sum = 0;\r\n\t\r\n\tdebug(\"%d\\n\", clock());\r\n\t\r\n\tvector<char> mu(B + 1);\r\n\tmu[1] = 1;\r\n\tfor (a = 2; a <= B; ++a) if (!mu[a]) for (b = a; b <= B; b += a) mu[b] = mu[b] < 0 ? 1 : -1;\r\n\tfor (a = 2; a * a <= B; ++a) if (mu[a * a]) for (b = a * a; b <= B; b += a * a) mu[b] = 0;\r\n\t\r\n\tvector<int> pi(U), primes(U), md(U);\r\n\tu32 count = 0;\r\n\tmd[1] = 1 << 30, primes[0] = 1;\r\n\tfor (a = 6; a < U; a += 3) md[a] = 3;\r\n\tfor (a = 4; a < U; a += 2) md[a] = 2;\r\n\tfor (a = 4; a * a < U; ++a) if (!md[a]) {\r\n\t\tfor (b = a * a; b < U; b += 6 * a) if (!md[b]) md[b] = a;\r\n\t\tfor (b = a * (a + (3 - a % 3) * 2); b < U; b += 6 * a) if (!md[b]) md[b] = a;\r\n\t}\r\n\tfor (a = 2; a < U; ++a) pi[a] = md[a] ? pi[a - 1] : (primes[++count] = md[a] = a, pi[a - 1] + 1);\r\n\t\r\n\tdebug(\"%d\\n\", clock());\r\n\t\r\n\tsum += pi[B] - 1;\r\n\tfor (p = pi[B] + 1; primes[p] <= S2; ++p) sum -= pi[x / primes[p]] - p + 1;\r\n\tfor (a = 1; a <= B; ++a) if (mu[a]) sum += mu[a] * (x / a);\r\n\tfor (p = sqrtl(x / primes[pi[B]]) + 1; p <= B; ++p) if (pi[p] != pi[p - 1]) sum += pi[B] - pi[std::max(u32(x / p / p), p)];\r\n\t\r\n\tdebug(\"%d\\n\", clock());\r\n\t\r\n\tfor (p = S4 + 1; p <= S3; ++p) if (pi[p] != pi[p - 1]) {\r\n\t\tu32 L = p + 1, R = std::min((u64)B, x / p / p);\r\n\t\tsum += (i64)(2 - pi[p]) * (pi[R] - pi[L - 1]);\r\n\t\tu64 m = x / p;\r\n\t\tfor (u = L; u <= R; u = v + 1) {\r\n\t\t\tt = pi[m / u];\r\n\t\t\tv = m / primes[t];\r\n\t\t\tif (v > R) v = R;\r\n\t\t\tsum += (i64)(pi[v] - pi[u - 1]) * t;\r\n\t\t}\r\n\t}\r\n\t\r\n\tdebug(\"%d\\n\", clock());\r\n\t\r\n\tvector<int> bit(U);\r\n\tfor (r = 1; r < U; ++r) if (md[r] > S4) ++bit[r];\r\n\tfor (r = 1; r < U; ++r) if (r + lowbit(r) < U) bit[r + lowbit(r)] += bit[r];\r\n\tfor (p = S4; p > S0; --p) if (pi[p] != pi[p - 1]) {\r\n\t\tfor (r = p; r < U; r += p) if (md[r] == p) for (a = r; a < U; a += lowbit(a)) ++bit[a];\r\n\t\tu32 L = 1, R = x / p / p;\r\n\t\tu64 m = x / p;\r\n\t\tw0 = w1 = 0;\r\n\t\tif ((u64)L * B <= m) {\r\n\t\t\tb = std::min((u64)R, m / B);\r\n\t\t\tfor (a = b; a; a -= lowbit(a)) w1 += bit[a];\r\n\t\t\tsum += (i64)(pi[B] - pi[p]) * (w1 - w0);\r\n\t\t\tL = b + 1;\r\n\t\t}\r\n\t\tfor (u = L; u <= R; u = v + 1) {\r\n\t\t\tv = m / primes[pi[m / u]];\r\n\t\t\tif (v > R) v = R;\r\n\t\t\tw0 = w1, w1 = 0;\r\n\t\t\tfor (a = v; a; a -= lowbit(a)) w1 += bit[a];\r\n\t\t\tsum += (i64)(pi[m / u] - pi[p]) * (w1 - w0);\r\n\t\t}\r\n\t}\r\n\t\r\n\tdebug(\"%d\\n\", clock());\r\n\t\r\n\tvector<int> coef(B + 1), lpos(B + 1);\r\n\tfor (q = 1; q <= B; ++q) if (md[q] > S0) coef[q] = -mu[q];\r\n\tint num = 0;\r\n\tfor (p = S0; p >= eps_bit; --p) if (pi[p] != pi[p - 1]) {\r\n\t\tfor (r = p; r < U; r += p) if (md[r] == p) for (++num, a = r; a < U; a += lowbit(a)) ++bit[a];\r\n\t\tfor (q = 1; q <= B; ++q) {\r\n\t\t\tlpos[q] = lpos[q - 1], coef[q] = coef[q - 1];\r\n\t\t\tif (md[q] > p) lpos[q] = q, coef[q] -= mu[q];\r\n\t\t}\r\n\t\tu32 L = 1, R = U - eps;\r\n\t\tu64 m = x / p;\r\n\t\tw0 = w1 = 0;\r\n\t\tif ((u64)L * B <= m) {\r\n\t\t\tb = std::min((u64)R, m / B);\r\n\t\t\tfor (a = b; a; a -= lowbit(a)) w1 += bit[a];\r\n\t\t\tsum += (i64)(coef[B] - coef[B / p]) * (w1 - w0);\r\n\t\t\tL = b + 1;\r\n\t\t}\r\n\t\tfor (u = L; u <= R; u = v + 1) {\r\n\t\t\tv = m / lpos[m / u];\r\n\t\t\tif (v > R) v = R;\r\n\t\t\tw0 = w1, w1 = 0;\r\n\t\t\tfor (a = v; a; a -= lowbit(a)) w1 += bit[a];\r\n\t\t\tsum += (i64)(coef[m / u] - coef[B / p]) * (w1 - w0);\r\n\t\t}\r\n\t}\r\n\tfor (; p >= 1; --p) if (pi[p] != pi[p - 1]) {\r\n\t\tfor (r = 1; r < U; ++r) bit[r] = bit[r - 1] + (md[r] >= p);\r\n\t\tfor (q = 1; q <= B; ++q) {\r\n\t\t\tlpos[q] = lpos[q - 1], coef[q] = coef[q - 1];\r\n\t\t\tif (md[q] > p && mu[q] != 0) lpos[q] = q, coef[q] -= mu[q];\r\n\t\t}\r\n\t\tu32 L = 1, R = U - eps;\r\n\t\tu64 m = x / p;\r\n\t\tif ((u64)L * B <= m) {\r\n\t\t\tb = std::min((u64)R, m / B);\r\n\t\t\tsum += (i64)(coef[B] - coef[B / p]) * bit[b];\r\n\t\t\tL = b + 1;\r\n\t\t}\r\n\t\tfor (u = L; u <= R; u = v + 1) {\r\n\t\t\tv = m / lpos[m / u];\r\n\t\t\tif (v > R) v = R;\r\n\t\t\tsum += (i64)(coef[m / u] - coef[B / p]) * (bit[v] - bit[u - 1]);\r\n\t\t}\r\n\t}\r\n\t\r\n\tdebug(\"%d\\n\", clock());\r\n\t\r\n\treturn sum;\r\n}\r\n\r\nint main(){\r\n#ifdef whzzt\r\n\tfreopen(\"in.txt\", \"r\", stdin);\r\n#endif\r\n\tu64 n;\r\n\tscanf(\"%llu\", &n);\r\n\tprintf(\"%llu\\n\", count_primes(n));\r\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:17:12: error: ‘vector’ has not been declared in ‘std’\n 17 | using std::vector;\n | ^~~~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp: In function ‘u64 count_primes(u64)’:\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:27:18: error: ‘sqrtl’ was not declared in this scope; did you mean ‘strtol’?\n 27 | u32 S2 = sqrtl(x);\n | ^~~~~\n | strtol\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:28:18: error: ‘powl’ was not declared in this scope\n 28 | u32 S3 = powl(x, 1.0 / 3);\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:30:63: error: ‘log’ was not declared in this scope; did you mean ‘long’?\n 30 | u32 B = std::max(2ull, std::min(u64(S2), u64(S3 * pow(log(x), 3) * 0.0001)));\n | ^~~\n | long\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:30:59: error: ‘pow’ was not declared in this scope\n 30 | u32 B = std::max(2ull, std::min(u64(S2), u64(S3 * pow(log(x), 3) * 0.0001)));\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:39:9: error: ‘vector’ was not declared in this scope\n 39 | vector<char> mu(B + 1);\n | ^~~~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:39:16: error: expected primary-expression before ‘char’\n 39 | vector<char> mu(B + 1);\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:40:9: error: ‘mu’ was not declared in this scope; did you mean ‘u’?\n 40 | mu[1] = 1;\n | ^~\n | u\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:44:16: error: expected primary-expression before ‘int’\n 44 | vector<int> pi(U), primes(U), md(U);\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:46:9: error: ‘md’ was not declared in this scope\n 46 | md[1] = 1 << 30, primes[0] = 1;\n | ^~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:46:26: error: ‘primes’ was not declared in this scope\n 46 | md[1] = 1 << 30, primes[0] = 1;\n | ^~~~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:53:33: error: ‘pi’ was not declared in this scope; did you mean ‘p’?\n 53 | for (a = 2; a < U; ++a) pi[a] = md[a] ? pi[a - 1] : (primes[++count] = md[a] = a, pi[a - 1] + 1);\n | ^~\n | p\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:57:16: error: ‘pi’ was not declared in this scope; did you mean ‘p’?\n 57 | sum += pi[B] - 1;\n | ^~\n | p\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:78:16: error: expected primary-expression before ‘int’\n 78 | vector<int> bit(U);\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:79:51: error: ‘bit’ was not declared in this scope\n 79 | for (r = 1; r < U; ++r) if (md[r] > S4) ++bit[r];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:80:56: error: ‘bit’ was not declared in this scope\n 80 | for (r = 1; r < U; ++r) if (r + lowbit(r) < U) bit[r + lowbit(r)] += bit[r];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:82:97: error: ‘bit’ was not declared in this scope\n 82 | for (r = p; r < U; r += p) if (md[r] == p) for (a = r; a < U; a += lowbit(a)) ++bit[a];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:88:62: error: ‘bit’ was not declared in this scope\n 88 | for (a = b; a; a -= lowbit(a)) w1 += bit[a];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:96:62: error: ‘bit’ was not declared in this scope\n 96 | for (a = v; a; a -= lowbit(a)) w1 += bit[a];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:103:16: error: expected primary-expression before ‘int’\n 103 | vector<int> coef(B + 1), lpos(B + 1);\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:104:50: error: ‘coef’ was not declared in this scope\n 104 | for (q = 1; q <= B; ++q) if (md[q] > S0) coef[q] = -mu[q];\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:107:104: error: ‘bit’ was not declared in this scope\n 107 | for (r = p; r < U; r += p) if (md[r] == p) for (++num, a = r; a < U; a += lowbit(a)) ++bit[a];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:109:25: error: ‘lpos’ was not declared in this scope\n 109 | lpos[q] = lpos[q - 1], coef[q] = coef[q - 1];\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:109:48: error: ‘coef’ was not declared in this scope\n 109 | lpos[q] = lpos[q - 1], coef[q] = coef[q - 1];\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:117:62: error: ‘bit’ was not declared in this scope\n 117 | for (a = b; a; a -= lowbit(a)) w1 += bit[a];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:118:38: error: ‘coef’ was not declared in this scope\n 118 | sum += (i64)(coef[B] - coef[B / p]) * (w1 - w0);\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:122:33: error: ‘lpos’ was not declared in this scope\n 122 | v = m / lpos[m / u];\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:125:62: error: ‘bit’ was not declared in this scope\n 125 | for (a = v; a; a -= lowbit(a)) w1 += bit[a];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:126:38: error: ‘coef’ was not declared in this scope\n 126 | sum += (i64)(coef[m / u] - coef[B / p]) * (w1 - w0);\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:130:41: error: ‘bit’ was not declared in this scope\n 130 | for (r = 1; r < U; ++r) bit[r] = bit[r - 1] + (md[r] >= p);\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:132:25: error: ‘lpos’ was not declared in this scope\n 132 | lpos[q] = lpos[q - 1], coef[q] = coef[q - 1];\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:132:48: error: ‘coef’ was not declared in this scope\n 132 | lpos[q] = lpos[q - 1], coef[q] = coef[q - 1];\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:139:38: error: ‘coef’ was not declared in this scope\n 139 | sum += (i64)(coef[B] - coef[B / p]) * bit[b];\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:139:63: error: ‘bit’ was not declared in this scope\n 139 | sum += (i64)(coef[B] - coef[B / p]) * bit[b];\n | ^~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:143:33: error: ‘lpos’ was not declared in this scope\n 143 | v = m / lpos[m / u];\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:145:38: error: ‘coef’ was not declared in this scope\n 145 | sum += (i64)(coef[m / u] - coef[B / p]) * (bit[v] - bit[u - 1]);\n | ^~~~\n/tmp/tmp1psqd8mz/2db50394-e85f-4711-bd4b-a11d31432ea7.cpp:145:68: error: ‘bit’ was not declared in this scope\n 145 | sum += (i64)(coef[m / u] - coef[B / p]) * (bit[v] - bit[u - 1]);\n | ^~~\n" | |
| ], | |
| "tcb_id": "区间素数个数" | |
| }, | |
| { | |
| "code_id": 4, | |
| "code": "int x[1][2]={1,0};\nint y[1][2]={0,1};\nlong long int ansx;\nlong long int ansy;\nint tru=0;\n\nint gcd( long long int a,long long int b)\n{\n if(a==0)\n return b;\n return gcd(b%a,a);\n\n}\nvoid e_gcd(long long int a,long long int b,long long int c)\n{\n long long int xx=a;\n long long int yy=b,zz=c;\n while(a!=1&&b!=1)\n {\n if(a<b)\n {\n\n x[0][0]=x[0][0]+b/a*x[0][1];\n y[0][0]=y[0][0]+b/a*y[0][1];\n b=b%a;\n\n }\n else\n {\n\n x[0][1]=x[0][1]+a/b*x[0][0];\n y[0][1]=y[0][1]+a/b*y[0][0];\n a=a%b;\n }\n }\n if(a==1)\n {\n ansx=-y[0][1];ansy=x[0][1];\n if(ansx*x[0][0]+ansy*y[0][0]!=1)\n {\n ansx*=-1;ansy*=-1;\n }\n\n }\n else\n {\n ansx=-y[0][0];ansy=x[0][0];\n if(ansx*x[0][1]+ansy*y[0][1]!=1)\n {\n ansx*=-1;ansy*=-1;\n }\n }\n if(ansx>b)\n {\n ansx= ansx%b==0?b:ansx%b;\n\n }\n if(ansx<0)\n {\n //printf(\"%d\\n\",((-ansx)/b+1)*b);\n ansx=((-ansx)/yy+1)*yy+ansx;\n }\n\n printf(\"%d\",ansx);\n\n}\n\n#include<stdio.h>\nint main()\n{\n srand((unsigned int)time(NULL));\n long long int a=0,b=0,c=0,n=500,flaga=1,flagb=1;\n scanf(\"%lld%lld\",&a,&b);\n\n flaga=flagb=1;\n\n\n e_gcd(a,b,1);\n // ansx*=flaga;ansy*=flagb;\n //printf(\"%lld %lld\\n\",(ansx),(ansy));\n\n return 0;\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "cc1plus: warning: command-line option ‘-std=c17’ is valid for C/ObjC but not for C++\n/tmp/tmppkp8y70u/d5e256e6-9a62-4541-8fec-848f65d07ca3.cpp: In function ‘void e_gcd(long long int, long long int, long long int)’:\n/tmp/tmppkp8y70u/d5e256e6-9a62-4541-8fec-848f65d07ca3.cpp:64:4: error: ‘printf’ was not declared in this scope\n 64 | printf(\"%d\",ansx);\n | ^~~~~~\n/tmp/tmppkp8y70u/d5e256e6-9a62-4541-8fec-848f65d07ca3.cpp:1:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?\n +++ |+#include <cstdio>\n 1 | int x[1][2]={1,0};\n/tmp/tmppkp8y70u/d5e256e6-9a62-4541-8fec-848f65d07ca3.cpp: In function ‘int main()’:\n/tmp/tmppkp8y70u/d5e256e6-9a62-4541-8fec-848f65d07ca3.cpp:71:25: error: ‘time’ was not declared in this scope\n 71 | srand((unsigned int)time(NULL));\n | ^~~~\n/tmp/tmppkp8y70u/d5e256e6-9a62-4541-8fec-848f65d07ca3.cpp:71:5: error: ‘srand’ was not declared in this scope\n 71 | srand((unsigned int)time(NULL));\n | ^~~~~\n" | |
| ], | |
| "tcb_id": "同余方程" | |
| }, | |
| { | |
| "code_id": 0, | |
| "code": "// GENERATE DATE: 2023-06-08 20:23:28.672307\n// #define ALGO_DISABLE_SIMD_AVX2\n// GENERATE FROM: https://github.com/rogeryoungh/algorithm-cpp\n#include <cstdint>\nusing i8 = signed char;\nusing i16 = std::int16_t;\nusing i32 = std::int32_t;\nusing i64 = std::int64_t;\nusing i128 = __int128_t;\nusing u8 = std::uint8_t;\nusing u16 = std::uint16_t;\nusing u32 = std::uint32_t;\nusing u64 = std::uint64_t;\nusing u128 = __uint128_t;\n#include <cstring>\n#include <string>\n#include <vector>\n// ALGO_IO_NUMBER_ONLY 输入只有 0-9、-、空格、换行\nnamespace detail {\ntemplate <class Buf>\nstruct FastI : Buf {\n using Buf::pop;\n using Buf::top;\n FastI(FILE *f, u32 size = 1 << 18) : Buf(f, size) {}\n void skipSpace() {\n while (top() <= ' ')\n pop();\n }\n FastI &operator>>(char &x) {\n skipSpace();\n x = pop();\n return *this;\n }\n FastI &operator>>(std::string &x) {\n x.resize(0);\n skipSpace();\n while (std::isgraph(top()))\n x.push_back(pop());\n return *this;\n }\n template <std::unsigned_integral T>\n FastI &operator>>(T &x) {\n x = 0;\n skipSpace();\n while (top() >= '0')\n x = x * 10 + (pop() & 0xf);\n return *this;\n }\n template <std::signed_integral T>\n FastI &operator>>(T &x) {\n bool neg = false;\n x = 0;\n skipSpace();\n if (top() == '-')\n neg = true, pop();\n while (top() >= '0')\n x = x * 10 + (pop() & 0xf);\n x = neg ? -x : x;\n return *this;\n }\n};\ntemplate <class Buf>\nstruct FastO : Buf {\n using Buf::push;\n using Buf::push_uncheck;\n using Buf::puts;\n std::vector<u32> pre;\n FastO(FILE *f, u32 size = 1 << 18) : Buf(f, size), pre(u64(1E4)) {\n for (i32 i = 0; i < i32(u64(1E4)); ++i) {\n i32 ti = i;\n for (i32 j = 0; j < 4; ++j) {\n pre[i] = pre[i] << 8 | ti % 10 | 0x30;\n ti /= 10;\n }\n }\n }\n ~FastO() {\n Buf::flush();\n }\n template <std::signed_integral T>\n FastO &operator<<(T x) {\n if (x < 0)\n push('-'), x = -x;\n return *this << std::make_unsigned<T>::type(x);\n }\n void output4(u32 t) {\n auto tp = (const char *)&pre[t];\n if (t >= u64(1E2)) {\n if (t >= u64(1E3))\n push_uncheck(tp, 4);\n else\n push_uncheck(tp + 1, 3);\n } else {\n if (t >= u64(1E1))\n push_uncheck(tp + 2, 2);\n else\n push_uncheck(t | 0x30);\n }\n };\n template <std::unsigned_integral T>\n FastO &operator<<(T x) {\n Buf::reserve(32);\n if (x >= u64(1E8)) {\n u64 q0 = x / u64(1E8), r0 = x % u64(1E8);\n if (x >= u64(1E16)) {\n u64 q1 = q0 / u64(1E8), r1 = q0 % u64(1E8);\n output4(q1);\n push_uncheck(&pre[r1 / u64(1E4)], 4);\n push_uncheck(&pre[r1 % u64(1E4)], 4);\n } else if (x >= u64(1E12)) {\n output4(q0 / u64(1E4));\n push_uncheck(&pre[q0 % u64(1E4)], 4);\n } else {\n output4(q0);\n }\n push_uncheck(&pre[r0 / u64(1E4)], 4);\n push_uncheck(&pre[r0 % u64(1E4)], 4);\n } else {\n if (x >= u64(1E4)) {\n output4(x / u64(1E4));\n push_uncheck(&pre[x % u64(1E4)], 4);\n } else {\n output4(x);\n }\n }\n return *this;\n }\n FastO &operator<<(char x) {\n return push(x), *this;\n }\n FastO &operator<<(const char *x) {\n return puts(x), *this;\n }\n FastO &operator<<(const std::string &x) {\n return push(x.c_str(), x.size()), *this;\n }\n};\nstruct BufO {\n FILE *f;\n char *beg, *end, *p;\n BufO(FILE *f_, u32 sz) : f(f_), beg(new char[sz]), end(beg + sz - 1), p(beg) {}\n ~BufO() {\n delete[] beg;\n }\n void flush() {\n std::fwrite(beg, 1, p - beg, f);\n p = beg;\n }\n void reserve(u32 len) {\n if (end - p <= i32(len))\n flush();\n }\n void push(char s) {\n *p++ = s;\n reserve(0);\n }\n void push(const char *s, u32 len) {\n reserve(len);\n push_uncheck(s, len);\n }\n void push_uncheck(char s) {\n *p++ = s;\n }\n void push_uncheck(const void *s, u32 len) {\n std::memcpy(p, s, len);\n p += len;\n }\n void puts(const char *s) {\n while (*s != 0)\n push(*s++);\n }\n};\n} // namespace detail\n#include <sys/mman.h>\n#include <sys/stat.h>\nnamespace detail {\nstruct BufI {\n struct stat sb;\n char *p;\n BufI(FILE *f, u32) {\n i32 fd = fileno(f);\n fstat(fd, &sb);\n p = (char *)mmap(nullptr, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);\n madvise(p, sb.st_size, MADV_SEQUENTIAL);\n }\n ~BufI() {\n munmap(p, sb.st_size);\n }\n char pop() {\n return *p++;\n }\n char top() const {\n return *p;\n }\n};\n} // namespace detail\nusing FastI = detail::FastI<detail::BufI>;\nusing FastO = detail::FastO<detail::BufO>;\n#include <type_traits>\ntemplate <class T, T MOD>\nstruct MontgomerySpace;\ntemplate <u32 MOD>\nstruct MontgomerySpace<u32, MOD> {\n static_assert(2 < MOD && MOD < u32(1) << 30, \"mod must in [3, 2^30)\");\n static_assert(MOD % 2 == 1, \"mod must be odd\");\n using ValueT = u32;\n using TransT = u32;\n using rawU32 = std::false_type;\n using isMontgomery = std::true_type;\n constexpr static u32 get_nr() {\n u32 x = 1;\n for (i32 i = 0; i < 5; ++i)\n x *= 2 - x * MOD;\n return x;\n }\n consteval static u32 mod() {\n return MOD;\n }\n enum : u32 {\n R = u32(u64(1) << 32 % MOD),\n IR = u32(-get_nr()),\n MOD2 = MOD * 2,\n };\n constexpr static TransT trans(ValueT x) {\n return (u64(x) << 32) % MOD;\n }\n constexpr static u32 reduce(u64 x) {\n return (x + u64(u32(x) * IR) * MOD) >> 32;\n }\n constexpr static u32 reduce_m(u32 n) {\n return n >> 31 ? n + MOD : n;\n }\n constexpr static u32 reduce_2m(u32 n) {\n return n >> 31 ? n + MOD2 : n;\n }\n constexpr static u32 add(u32 a, u32 b) {\n return reduce_2m(a + b - MOD2);\n }\n constexpr static u32 sub(u32 a, u32 b) {\n return reduce_2m(a - b);\n }\n constexpr static u32 mul(u32 a, u32 b) {\n return reduce(u64(a) * b);\n }\n constexpr static u32 muladd(u32 a, u32 b, u32 c) { // a * b + c\n return reduce(u64(a) * b + c);\n }\n constexpr static u32 mulsub(u32 a, u32 b, u32 c) { // a * b - c\n return reduce(u64(a) * b + MOD2 - c);\n }\n constexpr static u32 addmul(u32 a, u32 b, u32 c) { // (a + b) * c\n return reduce(u64(a + b) * c);\n }\n constexpr static u32 submul(u32 a, u32 b, u32 c) { // (a - b) * c\n return reduce(u64(a + MOD2 - b) * c);\n }\n constexpr static u32 safe(i64 x) {\n return reduce_m(x % MOD);\n }\n constexpr static ValueT val(TransT x) {\n return reduce_m(reduce(x) - MOD);\n }\n constexpr static u32 shift2(u32 x) {\n x = reduce(x);\n return (x & 1 ? x + MOD : x) >> 1;\n }\n};\nconstexpr u32 qpow(u32 a, u64 b, u32 m) {\n u32 r = 1;\n for (; b > 0; b /= 2) {\n if (b % 2 == 1)\n r = u64(a) * r % m;\n a = u64(a) * a % m;\n }\n return r;\n}\n#include <algorithm>\n#include <cassert>\n#include <optional>\nu32 legendre(u32 a, u32 p) {\n return qpow(a, (p - 1) / 2, p);\n}\ntemplate <class ModT>\nModT legendre(ModT a) {\n return a.pow((ModT::mod() - 1) / 2);\n}\nstd::optional<u32> cipola(u32 n, u32 p) {\n if (n == 0)\n return 0;\n if (legendre(n, p) != 1)\n return std::nullopt;\n if (p == 2)\n return 1;\n for (u32 a = 0; a < p; a++) {\n u32 i = (a * a - n + p) % p;\n using FP2 = std::pair<u64, u64>;\n auto mul = [p, i](const FP2 &l, const FP2 &r) {\n auto [la, lb] = l;\n auto [ra, rb] = r;\n return FP2{(la * ra + lb * rb % p * i) % p, (lb * ra + la * rb) % p};\n };\n if (legendre(i, p) == p - 1) {\n FP2 x = {1, 1}, u = {a, 1};\n for (int b = (p + 1) / 2; b; b /= 2) {\n if (b % 2 == 1)\n x = mul(x, u);\n u = mul(u, u);\n }\n return std::min(x.first, p - x.first);\n }\n }\n return std::nullopt;\n}\ntemplate <class ModT>\nstd::optional<u32> cipola(const ModT &n) {\n if (n == 0)\n return 0;\n const u32 P = ModT::mod();\n if (legendre(n) != 1)\n return std::nullopt;\n if (P == 2)\n return 1;\n for (u32 a = 0; a < P; a++) {\n ModT i = a;\n i = i * i - n;\n using FP2 = std::pair<ModT, ModT>;\n auto mul = [i](const FP2 &l, const FP2 &r) {\n auto [la, lb] = l;\n auto [ra, rb] = r;\n return FP2{la * ra + lb * rb * i, lb * ra + la * rb};\n };\n if (legendre(i) == ModT(P - 1)) {\n FP2 x = {1, 1}, u = {a, 1};\n for (i32 b = (P + 1) / 2; b; b /= 2) {\n if (b % 2 == 1)\n x = mul(x, u);\n u = mul(u, u);\n }\n return std::min(x.first.val(), P - x.first.val());\n }\n }\n return std::nullopt;\n}\n#include <type_traits>\ntemplate <class T, T MOD>\nstruct BasicModSpace;\ntemplate <u32 MOD>\nstruct BasicModSpace<u32, MOD> {\n static_assert(2 < MOD && MOD < u32(1) << 31, \"mod must in [3, 2^31)\");\n using ValueT = u32;\n using TransT = u32;\n using rawU32 = std::true_type;\n using isMontgomery = std::false_type;\n enum : u32 {\n MOD2 = MOD * 2,\n };\n constexpr static u32 mod() {\n return MOD;\n }\n constexpr static TransT trans(ValueT x) {\n return x;\n }\n constexpr static ValueT val(TransT x) {\n return reduce_m(x);\n }\n constexpr static u32 reduce_m(ValueT n) {\n return n >> 31 ? n + MOD : n;\n }\n constexpr static u32 reduce_2m(u32 n) {\n return n >> 31 ? n + MOD2 : n;\n }\n constexpr static u32 add(u32 a, u32 b) {\n return reduce_m(a + b - MOD);\n }\n constexpr static u32 sub(u32 a, u32 b) {\n return reduce_m(a - b);\n }\n constexpr static u32 mul(u32 a, u32 b) {\n return u64(a) * b % MOD;\n }\n constexpr static u32 muladd(u32 a, u32 b, u32 c) { // a * b + c\n return (u64(a) * b + c) % MOD;\n }\n constexpr static u32 mulsub(u32 a, u32 b, u32 c) { // a * b - c\n return (u64(a) * b + MOD - c) % MOD;\n }\n constexpr static u32 addmul(u32 a, u32 b, u32 c) { // (a + b) * c\n return u64(a + b) * c % MOD;\n }\n constexpr static u32 submul(u32 a, u32 b, u32 c) { // (a - b) * c\n return u64(a + MOD - b) * c % MOD;\n }\n constexpr static u32 safe(i64 x) {\n return reduce_m(x % MOD);\n }\n constexpr static u32 shift2(u32 x) {\n return (x & 1 ? x + MOD : x) >> 1;\n }\n};\n#include <iostream>\n// 封装 Modint,功能由 Space 提供\ntemplate <class Space_>\nstruct StaticModint {\n using Space = Space_;\n using ValueT = typename Space::ValueT;\n using TransT = typename Space::TransT;\n using isStatic = std::true_type;\n using rawU32 = typename Space::rawU32;\n using isMontgomery = typename Space::isMontgomery;\n TransT v;\n constexpr StaticModint() = default;\n constexpr StaticModint(ValueT v_) : v(Space::trans(v_)) {}\n using Self = StaticModint;\n explicit operator ValueT() const {\n return val();\n }\n constexpr static Self safe(i64 v) {\n return Self::raw(Space::safe(v));\n }\n constexpr static Self raw(u32 v) {\n Self r;\n r.v = v;\n return r;\n }\n constexpr ValueT val() const {\n return Space::val(v);\n }\n constexpr TransT raw() const {\n return v;\n }\n constexpr static ValueT mod() {\n return Space::mod();\n }\n constexpr Self &operator+=(const Self &rhs) {\n v = Space::add(v, rhs.v);\n return *this;\n }\n constexpr Self &operator-=(const Self &rhs) {\n v = Space::sub(v, rhs.v);\n return *this;\n }\n constexpr Self &operator*=(const Self &rhs) {\n v = Space::mul(v, rhs.v);\n return *this;\n }\n friend constexpr inline Self operator+(const Self &lhs, const Self &rhs) {\n return Self(lhs) += rhs;\n }\n friend constexpr inline Self operator-(const Self &lhs, const Self &rhs) {\n return Self(lhs) -= rhs;\n }\n friend constexpr inline Self operator*(const Self &lhs, const Self &rhs) {\n return Self(lhs) *= rhs;\n }\n constexpr Self pow(u64 n) const {\n Self r(1), a(*this);\n for (; n > 0; n /= 2) {\n if (n % 2 == 1)\n r *= a;\n a *= a;\n }\n return r;\n }\n constexpr Self inv() const {\n return pow(Space::mod() - 2);\n }\n constexpr Self &operator/=(const Self &rhs) {\n return *this *= rhs.inv();\n }\n friend constexpr inline Self operator/(const Self &lhs, const Self &rhs) {\n return Self(lhs) /= rhs;\n }\n constexpr Self operator-() const {\n return Self() -= *this;\n }\n constexpr std::optional<Self> sqrt() const {\n return cipola(*this);\n }\n constexpr Self shift2() const {\n return Space::shift2(v);\n }\n constexpr static Self muladd(const Self &a, const Self &b, const Self &c) { // a * b + c\n return raw(Space::muladd(a.raw(), b.raw(), c.raw()));\n }\n constexpr static Self mulsub(const Self &a, const Self &b, const Self &c) { // a * b - c\n return raw(Space::mulsub(a.raw(), b.raw(), c.raw()));\n }\n constexpr static Self addmul(const Self &a, const Self &b, const Self &c) { // (a + b) * c\n return raw(Space::addmul(a.raw(), b.raw(), c.raw()));\n }\n constexpr static Self submul(const Self &a, const Self &b, const Self &c) { // (a - b) * c\n return raw(Space::submul(a.raw(), b.raw(), c.raw()));\n }\n friend inline std::istream &operator>>(std::istream &is, Self &m) {\n i64 x;\n is >> x;\n m = Self::safe(x);\n return is;\n }\n friend inline std::ostream &operator<<(std::ostream &os, const Self &m) {\n return os << m.val();\n }\n friend inline bool operator==(const Self &lhs, const Self &rhs) {\n return lhs.val() == rhs.val();\n }\n friend inline bool operator!=(const Self &lhs, const Self &rhs) {\n return !(lhs == rhs);\n }\n};\ntemplate <class T, T MOD>\nusing BasicStaticModint = StaticModint<BasicModSpace<T, MOD>>;\ntemplate <class Space>\ninline FastI &operator>>(FastI &is, StaticModint<Space> &m) {\n i64 x;\n is >> x;\n m = StaticModint<Space>(x);\n return is;\n}\ntemplate <class Space>\ninline FastO &operator<<(FastO &os, const StaticModint<Space> &m) {\n return os << m.val();\n}\n#include <type_traits>\ntemplate <class ModT>\nconcept static_modint_concept = ModT::isStatic::value;\ntemplate <class ModT>\nconcept raw32_modint_concept = ModT::rawU32::value;\ntemplate <class ModT>\nconcept static_raw32_modint_concept = static_modint_concept<ModT> && raw32_modint_concept<ModT>;\ntemplate <class ModT>\nconcept runtime_modint_concept = !ModT::isStatic::value;\ntemplate <class ModT>\nconcept montgomery_modint_concept = ModT::isMontgomery::value;\ntemplate <class ModT>\nconcept static_basic_modint_concept = !montgomery_modint_concept<ModT> && static_modint_concept<ModT>;\n#include <algorithm>\n#include <bit>\n#include <cassert>\n#include <span>\n#include <vector>\nnamespace detail {\nu32 ntt_size = 0;\n} // namespace detail\n/////////////////////\n#include <algorithm>\n#include <bit>\n#include <cassert>\n#include <span>\n#include <vector>\nnamespace detail {\ntemplate <static_modint_concept ModT>\nauto &prepare_root_twisted_basic(u32 m) {\n using ValueT = typename ModT::ValueT;\n static constexpr ValueT P = ModT::mod();\n static constexpr ValueT g = 3;\n static constexpr ValueT max_bit = ValueT(1) << std::countr_zero(ModT::mod() - 1);\n static std::vector<ModT> rt{1, 1};\n assert(m <= max_bit);\n while (rt.size() < m) {\n u32 n = rt.size();\n rt.resize(n * 2);\n ModT p = ModT(g).pow((P - 1) / n / 2);\n for (u32 i = n; i < n * 2; i += 2) {\n rt[i] = rt[i / 2], rt[i + 1] = p * rt[i];\n }\n }\n return rt;\n}\ntemplate <static_modint_concept ModT>\nstatic void ntt_twisted_basic(std::span<ModT> f) { // dif\n i32 n = f.size();\n auto &rt = prepare_root_twisted_basic<ModT>(n);\n for (i32 l = n / 2; l > 0; l /= 2) {\n for (i32 i = 0; i < n; i += l * 2) {\n for (i32 j = 0; j < l; ++j) {\n ModT x = f[i + j], y = f[i + j + l];\n f[i + j] = x + y;\n f[i + j + l] = ModT::submul(x, y, rt[j + l]);\n }\n }\n }\n}\ntemplate <static_modint_concept ModT>\nstatic void intt_twisted_basic(std::span<ModT> f) { // dit\n i32 n = f.size();\n auto &rt = prepare_root_twisted_basic<ModT>(n);\n for (i32 l = 1; l < n; l *= 2) {\n for (i32 i = 0; i < n; i += l * 2) {\n for (i32 j = 0; j < l; ++j) {\n ModT x = f[i + j], y = rt[j + l] * f[i + j + l];\n f[i + j] = x + y;\n f[i + j + l] = x - y;\n }\n }\n }\n const ModT ivn = ModT(n).inv();\n for (i32 i = 0; i < n; i++)\n f[i] *= ivn;\n std::reverse(f.begin() + 1, f.end());\n}\n} // namespace detail\n#include <algorithm>\n#include <bit>\n#include <cassert>\n#include <span>\n#include <vector>\n#include <type_traits>\n// https://judge.yosupo.jp/submission/92714\n#pragma GCC target(\"avx2\")\n#include <immintrin.h>\n#include <array>\nnamespace simd {\nusing I256 = __m256i;\nusing I128x2 = I256;\nusing I64x4 = I256;\nusing I32x8 = I256;\nusing U32x8 = I256;\nusing U64x4 = I256;\nusing U128x2 = I256;\nnamespace i256 {\ninline I256 loadu(const I256 *p) {\n return _mm256_loadu_si256(p);\n}\ninline I256 load(const I256 *p) {\n return _mm256_load_si256(p);\n}\ninline void store(I256 *p, const I256 &v) {\n _mm256_store_si256(p, v);\n}\ninline void storeu(I256 *p, const I256 &v) {\n _mm256_storeu_si256(p, v);\n}\ntemplate <class T>\ninline auto to_array(const I256 &v) {\n constexpr u32 sizeT = sizeof(T);\n static_assert(sizeof(I256) % sizeT == 0);\n alignas(32) std::array<T, sizeT> arr;\n _mm256_store_si256((I256 *)arr.data(), v);\n return arr;\n}\ninline I256 bit_and(const I256 &a, const I256 &b) {\n return _mm256_and_si256(a, b);\n}\n} // namespace i256\nnamespace i128x2 {\ntemplate <i32 imm>\ninline I128x2 permute(const I128x2 &a, const I128x2 &b) {\n return _mm256_permute2x128_si256(a, b, imm);\n}\ntemplate <i32 imm>\ninline I128x2 shuffle(const I128x2 &a) {\n return permute<imm>(a, a);\n}\n} // namespace i128x2\nnamespace i64x4 {\ninline I64x4 add(const I64x4 &a, const I64x4 &b) {\n return _mm256_add_epi64(a, b);\n}\n} // namespace i64x4\nnamespace i32x8 {\ninline I32x8 from(i32 v) {\n return _mm256_set1_epi32(v);\n}\ninline I32x8 add(const I32x8 &a, const I32x8 &b) {\n return _mm256_add_epi32(a, b);\n}\ninline I32x8 sub(const I32x8 &a, const I32x8 &b) {\n return _mm256_sub_epi32(a, b);\n}\ninline I64x4 mul(const I32x8 &a, const I32x8 &b) {\n return _mm256_mul_epi32(a, b);\n}\ntemplate <i32 imm>\ninline I32x8 shuffle(const I32x8 &a) {\n return _mm256_shuffle_epi32(a, imm);\n}\ntemplate <i32 imm>\ninline I32x8 blend(const I32x8 &a, const I32x8 &b) {\n return _mm256_blend_epi32(a, b, imm);\n}\ninline I32x8 zero() {\n return _mm256_setzero_si256();\n}\ninline I32x8 sign(const I32x8 &a) {\n return _mm256_cmpgt_epi32(zero(), a);\n}\ninline auto mul_0246_1357(const I32x8 &a, const I32x8 &b) {\n auto x0246 = mul(a, b);\n auto x1357 = mul(shuffle<0b11110101>(a), shuffle<0b11110101>(b));\n alignas(32) std::pair<I64x4, I64x4> p = {x0246, x1357};\n return p;\n}\ninline I32x8 abs(const I32x8 &a) {\n return _mm256_abs_epi32(a);\n}\n} // namespace i32x8\nnamespace u32x8 {\ninline U64x4 mul(const U32x8 &a, const U32x8 &b) {\n return _mm256_mul_epu32(a, b);\n}\ninline auto mul_0246_1357(const U32x8 &a, const U32x8 &b) {\n auto x0246 = mul(a, b);\n auto x1357 = mul(i32x8::shuffle<0b11110101>(a), i32x8::shuffle<0b11110101>(b));\n alignas(32) std::pair<U64x4, U64x4> p = {x0246, x1357};\n return p;\n}\n} // namespace u32x8\n} // namespace simd\nnamespace simd {\n// 仅在 Montgomery 空间里\ntemplate <class ModT, bool global_aligned = false>\nstruct M32x8 {\n U32x8 v;\n M32x8() : v() {}\n M32x8(const U32x8 &a) : v(a) {}\n template <class S>\n M32x8(const M32x8<S> &a) : v(a.v) {}\n template <class U32>\n M32x8(const std::array<U32, 8> &a) {\n static_assert(sizeof(U32) == 4);\n v = i256::load((const I256 *)a.data());\n }\n template <bool aligned = global_aligned>\n static M32x8 load(const I256 *p) {\n M32x8 r;\n if constexpr (aligned) {\n r = i256::load(p);\n } else {\n r = i256::loadu(p);\n }\n return r;\n }\n static M32x8 from(u32 v) {\n return i32x8::from(v);\n }\n static M32x8 from(ModT v) {\n return from(v.raw());\n }\n inline static U32x8 Rx8 = i32x8::from(ModT::Space::R);\n inline static U32x8 IRx8 = i32x8::from(ModT::Space::IR);\n inline static U32x8 MOD2x8 = i32x8::from(ModT::Space::MOD2);\n inline static U32x8 MODx8 = i32x8::from(ModT::Space::mod());\n static U32x8 reduce_m(U32x8 v) {\n U32x8 sign = i32x8::sign(v);\n v = i32x8::add(v, i256::bit_and(sign, MODx8));\n return v;\n }\n static U32x8 reduce_2m(U32x8 v) {\n U32x8 sign = i32x8::sign(v);\n v = i32x8::add(v, i256::bit_and(sign, MOD2x8));\n return v;\n }\n M32x8 &operator+=(const M32x8 &rhs) {\n v = i32x8::add(v, rhs.v);\n v = i32x8::sub(v, MOD2x8);\n v = reduce_2m(v);\n return *this;\n }\n M32x8 &operator-=(const M32x8 &rhs) {\n v = i32x8::sub(v, rhs.v);\n v = reduce_2m(v);\n return *this;\n }\n static U32x8 reduce(const U64x4 &x0246, const U64x4 &x1357) {\n auto km0246 = u32x8::mul(u32x8::mul(x0246, IRx8), MODx8);\n auto km1357 = u32x8::mul(u32x8::mul(x1357, IRx8), MODx8);\n auto z0246 = i64x4::add(x0246, km0246);\n z0246 = i32x8::shuffle<0b11110101>(z0246);\n auto z1357 = i64x4::add(x1357, km1357);\n z1357 = i32x8::shuffle<0b11110101>(z1357);\n return i32x8::blend<0b10101010>(z0246, z1357);\n }\n M32x8 &operator*=(const M32x8 &rhs) {\n auto [x0246, x1357] = u32x8::mul_0246_1357(v, rhs.v);\n v = reduce(x0246, x1357);\n return *this;\n }\n friend M32x8 operator+(const M32x8 &lhs, const M32x8 &rhs) {\n return M32x8(lhs) += rhs;\n }\n friend M32x8 operator-(const M32x8 &lhs, const M32x8 &rhs) {\n return M32x8(lhs) -= rhs;\n }\n friend M32x8 operator*(const M32x8 &lhs, const M32x8 &rhs) {\n return M32x8(lhs) *= rhs;\n }\n constexpr static M32x8 addmul(const M32x8 &a, const M32x8 &b, const M32x8 &c) { // (a + b) * c\n auto v = i32x8::add(a.v, b.v);\n auto [x0246, x1357] = u32x8::mul_0246_1357(v, c.v);\n v = reduce(x0246, x1357);\n return v;\n }\n constexpr static M32x8 submul(const M32x8 &a, const M32x8 &b, const M32x8 &c) { // (a - b) * c\n auto v = i32x8::add(a.v, MOD2x8);\n v = i32x8::sub(v, b.v);\n auto [x0246, x1357] = u32x8::mul_0246_1357(v, c.v);\n v = reduce(x0246, x1357);\n return v;\n }\n U32x8 raw() const {\n return v;\n }\n template <i32 imm>\n M32x8 neg() const {\n auto m2 = i32x8::blend<imm>(i32x8::zero(), MOD2x8);\n return i32x8::abs(i32x8::sub(v, m2));\n }\n template <bool aligned = global_aligned>\n void store(I256 *p) {\n if constexpr (aligned) {\n i256::store(p, v);\n } else {\n i256::storeu(p, v);\n }\n }\n auto to_array() const {\n return i256::to_array<u32>(v);\n }\n template <i32 imm>\n M32x8 shuffle() const {\n return i32x8::shuffle<imm>(v);\n }\n template <i32 imm>\n M32x8 shufflex4() const {\n return i128x2::shuffle<imm>(v);\n }\n};\n} // namespace simd\nnamespace detail {\ntemplate <montgomery_modint_concept ModT>\nstruct NttTwistedInfoAvx {\n using X8 = simd::M32x8<ModT>;\n using ValueT = typename ModT::ValueT;\n static constexpr ValueT P = ModT::mod();\n static constexpr ValueT g = 3;\n static constexpr ValueT max_bit = ValueT(1) << std::countr_zero(ModT::mod() - 1);\n std::vector<X8> rt;\n NttTwistedInfoAvx() {\n init_rt(64);\n }\n void init_rt(i32 m) {\n assert(m <= max_bit);\n rt.resize(m / 8);\n std::span<ModT> rt0 = as_modt();\n rt0[0] = rt0[1] = 1;\n for (i32 n = 2; n < m; n *= 2) {\n ModT p = ModT(g).pow((P - 1) / n / 2);\n for (i32 i = n; i < n * 2; i += 2) {\n rt0[i] = rt0[i / 2], rt0[i + 1] = p * rt0[i];\n }\n }\n }\n auto as_modt() {\n return std::span{(ModT *)rt.data(), rt.size() * 8};\n }\n void prepare_root(i32 m) {\n assert(m <= max_bit);\n while (rt.size() < m) {\n u32 n = rt.size();\n rt.resize(n * 2);\n ModT p = ModT(g).pow((P - 1) / n / 2 / 8);\n alignas(32) std::array<ModT, 8> arr{};\n for (i32 i = 0; i < 8; ++i)\n arr[i] = i == 0 ? 1 : arr[i - 1] * p;\n X8 pp = arr, p8 = X8::from((arr[7] * p).raw());\n for (i32 i = n; i < n * 2; ++i) {\n rt[i] = pp, pp *= p8;\n }\n }\n }\n template <i32 L>\n X8 rt_small() {\n std::array<ModT, 8> r;\n std::span<ModT> rt0 = {(ModT *)rt.data(), 64};\n std::fill(r.begin(), r.end(), rt0[L + 0]);\n for (i32 i = 0; i < 8; i += L * 2) {\n for (i32 j = 0; j < L; ++j)\n r[i + j + L] = rt0[L + j];\n }\n return r;\n }\n static NttTwistedInfoAvx &instance() {\n static NttTwistedInfoAvx info{};\n return info;\n }\n};\ntemplate <montgomery_modint_concept ModT, bool aligned>\nstatic void ntt_twisted_avx(std::span<ModT> f0) { // dif\n using X8 = simd::M32x8<ModT, aligned>;\n static auto &info = NttTwistedInfoAvx<ModT>::instance();\n i32 n8 = f0.size(), n = n8 / 8;\n assert(n8 % 16 == 0);\n std::span<simd::I256> f{(simd::I256 *)f0.data(), u32(n)};\n info.prepare_root(n);\n static X8 rt2 = info.template rt_small<2>();\n static X8 rt4 = info.template rt_small<4>();\n for (i32 l = n / 2; l > 0; l /= 2) {\n for (i32 i = 0; i < n; i += l * 2) {\n for (i32 j = 0; j < l; ++j) {\n auto px = &f[i + j], py = &f[i + j + l];\n X8 fx = X8::load(px), fy = X8::load(py);\n X8 rx = fx + fy;\n X8 ry = X8::submul(fx, fy, info.rt[j + l]);\n rx.store(px), ry.store(py);\n }\n }\n }\n for (i32 i = 0; i < n; ++i) {\n X8 v = X8::load(&f[i]);\n v = v.template neg<0b11110000>() + v.template shufflex4<0b01>();\n v *= rt4;\n v = v.template neg<0b11001100>() + v.template shuffle<0b01001110>();\n v *= rt2;\n v = v.template neg<0b10101010>() + v.template shuffle<0b10110001>();\n v.store(&f[i]);\n }\n}\ntemplate <montgomery_modint_concept ModT, bool aligned>\nstatic void intt_twisted_avx(std::span<ModT> f0) { // dit\n using X8 = simd::M32x8<ModT, aligned>;\n static auto &info = NttTwistedInfoAvx<ModT>::instance();\n i32 n8 = f0.size(), n = n8 / 8;\n assert(n8 % 16 == 0);\n std::span<simd::I256> f{(simd::I256 *)f0.data(), u32(n)};\n info.prepare_root(n);\n static X8 rt2 = info.template rt_small<2>();\n static X8 rt4 = info.template rt_small<4>();\n for (i32 i = 0; i < n; ++i) {\n X8 fi = X8::load(&f[i]);\n fi = fi.template neg<0b10101010>() + fi.template shuffle<0b10110001>();\n fi *= rt2;\n fi = fi.template neg<0b11001100>() + fi.template shuffle<0b01001110>();\n fi *= rt4;\n fi = fi.template neg<0b11110000>() + fi.template shufflex4<0b01>();\n fi.store(&f[i]);\n }\n for (i64 l = 1; l < n; l *= 2) {\n for (i32 i = 0; i < n; i += l * 2) {\n for (i32 j = 0; j < l; ++j) {\n auto px = &f[i + j], py = &f[i + j + l];\n X8 fx = X8::load(px), fy = X8::load(py) * info.rt[j + l];\n X8 rx = fx + fy;\n X8 ry = fx - fy;\n rx.store(px), ry.store(py);\n }\n }\n }\n X8 ivn8 = X8::from(ModT(n8).inv().raw());\n for (i32 i = 0; i < n; ++i) {\n X8 fi = X8::load(&f[i]);\n fi *= ivn8;\n fi.store(&f[i]);\n }\n std::reverse(f0.begin() + 1, f0.end());\n}\n} // namespace detail\n// twisted-radix-2-avx2\ntemplate <static_modint_concept ModT>\nvoid ntt(std::span<ModT> f) {\n assert(std::has_single_bit<u32>(f.size()));\n detail::ntt_size += f.size();\n if constexpr (montgomery_modint_concept<ModT>) {\n if (f.size() < 16)\n detail::ntt_twisted_basic(f);\n else if (u64(f.data()) & 0x1f)\n detail::ntt_twisted_avx<ModT, false>(f);\n else\n detail::ntt_twisted_avx<ModT, true>(f);\n } else {\n detail::ntt_twisted_basic(f);\n }\n}\ntemplate <static_modint_concept ModT>\nvoid intt(std::span<ModT> f) {\n assert(std::has_single_bit<u32>(f.size()));\n detail::ntt_size += f.size();\n if constexpr (montgomery_modint_concept<ModT>) {\n if (f.size() < 16)\n detail::intt_twisted_basic(f);\n else if (u64(f.data()) & 0x1f)\n detail::intt_twisted_avx<ModT, false>(f);\n else\n detail::intt_twisted_avx<ModT, true>(f);\n } else {\n detail::intt_twisted_basic(f);\n }\n}\n#include <span>\ntemplate <static_modint_concept ModT>\nstatic void dot_basic(std::span<ModT> f, std::span<const ModT> g, std::span<ModT> dst) {\n u32 n = dst.size();\n for (u32 i = 0; i < n; i++)\n dst[i] = f[i] * g[i];\n}\ntemplate <static_modint_concept ModT>\nstatic void dot_basic(std::span<ModT> f, std::span<const ModT> g) {\n u32 n = f.size();\n for (u32 i = 0; i < n; i++)\n f[i] *= g[i];\n}\ntemplate <montgomery_modint_concept ModT>\nstatic void dot_avx(std::span<ModT> f, std::span<const ModT> g) {\n u32 n8 = f.size();\n u32 i = 0;\n using X8 = simd::M32x8<ModT>;\n for (; i + 7 < n8; i += 8) {\n X8 fi = X8::load((simd::I256 *)&f[i]);\n X8 gi = X8::load((simd::I256 *)&g[i]);\n fi *= gi;\n fi.store((simd::I256 *)&f[i]);\n }\n for (; i < n8; i++)\n f[i] *= g[i];\n}\ntemplate <montgomery_modint_concept ModT>\nstatic void dot_avx(std::span<simd::I256> f, std::span<const ModT> g, std::span<ModT> dst) {\n u32 n = dst.size();\n u32 i = 0;\n using X8 = simd::M32x8<ModT>;\n for (; i + 7 < n; i += 8) {\n X8 fi = X8::load((simd::I256 *)&f[i]);\n X8 gi = X8::load((simd::I256 *)&g[i]);\n X8 di = fi * gi;\n di.store((simd::I256 *)&dst[i]);\n }\n for (; i < n; i++)\n dst[i] = f[i] * g[i];\n}\ntemplate <static_modint_concept ModT>\nstatic void dot(std::span<ModT> f, std::span<const ModT> g, std::span<ModT> dst) {\n if constexpr (montgomery_modint_concept<ModT>) {\n dot_avx(f, g, dst);\n } else {\n dot_basic(f, g, dst);\n }\n}\ntemplate <static_modint_concept ModT>\nstatic void dot(std::span<ModT> f, std::span<const ModT> g) {\n if constexpr (montgomery_modint_concept<ModT>) {\n dot_avx(f, g);\n } else {\n dot_basic(f, g);\n }\n}\nusing Space = MontgomerySpace<u32, 998244353>;\nusing ModT = StaticModint<Space>;\ni32 main() {\n FastI fin(stdin);\n FastO fout(stdout);\n u32 n, m;\n fin >> n >> m;\n n++, m++;\n u32 L = std::bit_ceil(n + m - 1);\n // std::vector<ModT> f(L), g(L);\n ModT *f = new (std::align_val_t(32)) ModT[L];\n ModT *g = new (std::align_val_t(32)) ModT[L];\n for (i32 i = 0; i < n; ++i)\n fin >> f[i];\n for (i32 i = 0; i < m; ++i)\n fin >> g[i];\n ntt<ModT>({f, L}), ntt<ModT>({g, L});\n dot<ModT>({f, L}, {g, L});\n intt<ModT>({f, L});\n for (i32 i = 0; i < n + m - 1; ++i)\n fout << f[i] << ' ';\n std::cerr << std::endl << detail::ntt_size << std::endl;\n return 0;\n}\n\n", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp: In function ‘auto simd::i32x8::mul_0246_1357(const I32x8&, const I32x8&)’:\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:690:37: warning: ignoring attributes on template argument ‘simd::I64x4’ {aka ‘__m256i’} [-Wignored-attributes]\n 690 | alignas(32) std::pair<I64x4, I64x4> p = {x0246, x1357};\n | ^\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:690:37: warning: ignoring attributes on template argument ‘simd::I64x4’ {aka ‘__m256i’} [-Wignored-attributes]\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp: In function ‘auto simd::u32x8::mul_0246_1357(const U32x8&, const U32x8&)’:\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:704:37: warning: ignoring attributes on template argument ‘simd::U64x4’ {aka ‘__m256i’} [-Wignored-attributes]\n 704 | alignas(32) std::pair<U64x4, U64x4> p = {x0246, x1357};\n | ^\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:704:37: warning: ignoring attributes on template argument ‘simd::U64x4’ {aka ‘__m256i’} [-Wignored-attributes]\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp: In function ‘void detail::ntt_twisted_avx(std::span<_Type, 18446744073709551615>)’:\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:893:23: warning: ignoring attributes on template argument ‘simd::I256’ {aka ‘__m256i’} [-Wignored-attributes]\n 893 | std::span<simd::I256> f{(simd::I256 *)f0.data(), u32(n)};\n | ^\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp: In function ‘void detail::intt_twisted_avx(std::span<_Type, 18446744073709551615>)’:\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:924:23: warning: ignoring attributes on template argument ‘simd::I256’ {aka ‘__m256i’} [-Wignored-attributes]\n 924 | std::span<simd::I256> f{(simd::I256 *)f0.data(), u32(n)};\n | ^\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp: At global scope:\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:1016:41: warning: ignoring attributes on template argument ‘simd::I256’ {aka ‘__m256i’} [-Wignored-attributes]\n 1016 | static void dot_avx(std::span<simd::I256> f, std::span<const ModT> g, std::span<ModT> dst) {\n | ^\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp: In function ‘void __static_initialization_and_destruction_0(int, int)’:\n/tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:741:23: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]\n 741 | inline static U32x8 MOD2x8 = i32x8::from(ModT::Space::MOD2);\n | ^~~~~~\nduring RTL pass: expand\nIn file included from /usr/include/c++/11/bits/stl_algobase.h:64,\n from /usr/include/c++/11/bits/char_traits.h:39,\n from /usr/include/c++/11/string:40,\n from /tmp/tmpddxcgko5/76189a83-9f04-4423-a754-485365f35341.cpp:16:\n/usr/include/c++/11/bits/stl_pair.h: In constructor ‘constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = __vector(4) long long int&; _U2 = __vector(4) long long int&; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = true; _T1 = __vector(4) long long int; _T2 = __vector(4) long long int]’:\n/usr/include/c++/11/bits/stl_pair.h:353:11: internal compiler error: in convert_move, at expr.c:220\n 353 | : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n0x7f55f9205d8f __libc_start_call_main\n\t../sysdeps/nptl/libc_start_call_main.h:58\n0x7f55f9205e3f __libc_start_main_impl\n\t../csu/libc-start.c:392\nPlease submit a full bug report,\nwith preprocessed source if appropriate.\nPlease include the complete backtrace with any bug report.\nSee <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.\n" | |
| ], | |
| "tcb_id": "多项式乘法" | |
| }, | |
| { | |
| "code_id": 18, | |
| "code": "#include<cstdio>\r\n#include<cctype>\r\n\r\n#ifdef __GNUG__\r\n\t#pragma GCC diagnostic error \"-std=c++17\"\r\n#endif\r\n\r\n#ifdef __GNUG__\r\n\t#pragma GCC optimize(\"O3\")\r\n#endif\r\n\r\n#ifdef __linux\r\n\t#define getchar getchar_unlocked\r\n\t#define putchar putchar_unlocked\r\n#endif\r\n\r\ntemplate<typename ut>\r\nclass iopv\r\n{\r\npublic:\r\n\tvoid out(ut);\r\n\toperator ut(void);\r\npublic:\r\n\tiopv(void);\r\n\t~iopv(void);\r\n};\r\n\r\ntemplate<typename ut>\r\ninline\r\niopv<ut>::iopv(void)\r\n{\r\n}\r\n\r\ntemplate<typename ut>\r\ninline\r\niopv<ut>::~iopv(void)\r\n{\r\n}\r\n\r\ntemplate<typename ut>\r\ninline\r\niopv<ut>::operator ut(void)\r\n{\r\n\tchar s='#';\r\n\tut x=0,fg=0;\r\n\twhile(!isdigit(s))\r\n\t{\r\n\t\tfg|=s=='-';\r\n\t\ts=getchar();\r\n\t}\r\n\twhile(isdigit(s))\r\n\t{\r\n\t\tx=x*10+s-'0';\r\n\t\ts=getchar();\r\n\t}\r\n\treturn fg?-x:x;\r\n}\r\n\r\ntemplate<typename ut>\r\ninline\r\nvoid iopv<ut>::out(ut x)\r\n{\r\n\tstatic char z[20]={};\r\n\tchar *i=z;\r\n\tif(!x)\r\n\t\tputchar('0');\r\n\telse\r\n\t{\r\n\t\tif(x<0)\r\n\t\t\tputchar('-'),x=-x;\r\n\t\twhile(x)\r\n\t\t{\r\n\t\t\tut y=x/10;\r\n\t\t\t*i++=x-y*10+'0',x=y;\r\n\t\t}\r\n\t\twhile(i!=z)\r\n\t\t\tputchar(*--i);\r\n\t}\r\n\tputchar(' ');\r\n}\r\n\r\n#ifdef __linux\r\n\ttypedef long long __int64_t;\r\n#endif\r\n\r\n#ifdef __linux\r\n\t#undef getchar\r\n\t#undef putchar\r\n#endif\r\n\r\niopv<int>it;\r\niopv<__int64_t>xt;\r\n\r\n#include<vector>\r\n\r\nconst int __n=3e5;\r\n\r\nstatic int n=0,m=0;\r\n\r\nclass _e\r\n{\r\npublic:\r\n\tint w,p,d;\r\n\t__int64_t s;\r\n\tstd::vector<int>e;\r\n};\r\n\r\n_e e[__n]={};\r\n\r\nvoid ins(int u,int v)\r\n{\r\n\te[u].e.push_back(v);\r\n}\r\n\r\nint lca[__n]={},la[__n]={},nx[__n*2]={},to[__n*2]={};\r\n\r\nvoid iaq(int x,int y)\r\n{\r\n\tstatic size_t _t=1;\r\n\tto[++_t]=y,nx[_t]=la[x],la[x]=_t;\r\n}\r\n\r\nint find(int p)\r\n{\r\n\treturn e[p].p==p?p:e[p].p=find(e[p].p);\r\n}\r\n\r\nvoid tarjan(int u,int d)\r\n{\r\n\te[u].p=u,e[u].d=d;\r\n\tfor(int v:e[u].e)\r\n\t{\r\n\t\tif(!e[v].p)\r\n\t\t\ttarjan(v,d+1),e[v].p=u;\r\n\t}\r\n\tfor(int i=la[u];i;i=nx[i])\r\n\t{\r\n\t\tint v=to[i];\r\n\t\tif(e[v].p)\r\n\t\t\tlca[i>>1]=find(v);\r\n\t}\r\n}\r\n\r\nstruct nd\r\n{\r\n\tint ll[__n],nu[__n],ne[__n],_t;\r\n\tvoid ad(int,int);\r\n};\r\n\r\nvoid nd::ad(int x,int d)\r\n{\r\n\tnu[++_t]=d,ne[_t]=ll[x],ll[x]=_t;\r\n}\r\n\r\nnd aa,am,ba,bm;\r\n\r\nint x[__n*3][2]={},*a=&x[__n][0],*b=&x[__n][1];\r\n\r\nvoid color(nd &x,int *y,int u,int z)\r\n{\r\n\tfor(int i=x.ll[u];i;i=x.ne[i])\r\n\t\ty[x.nu[i]]+=z;\r\n}\r\n\r\nvoid dfs(int u,int f)\r\n{\r\n\te[u].s-=a[e[u].d+e[u].w]+b[e[u].d-e[u].w];\r\n\tcolor(aa,a,u,+1);\r\n\tcolor(ba,b,u,+1);\r\n\tfor(int v:e[u].e)\r\n\t{\r\n\t\tif(v!=f)\r\n\t\t\tdfs(v,u);\r\n\t}\r\n\tcolor(am,a,u,-1);\r\n\tcolor(bm,b,u,-1);\r\n\te[u].s+=b[e[u].d-e[u].w]+a[e[u].d+e[u].w];\r\n}\r\n\r\nint st[__n]={},ed[__n]={};\r\nvoid pre_work(void)\r\n{\r\n\tn=it,m=it;\r\n\tfor(int i=2;i<=n;i++)\r\n\t{\r\n\t\tint u=it,v=it;\r\n\t\tins(u,v),ins(v,u);\r\n\t}\r\n\tfor(int i=1;i<=n;i++)\r\n\t\te[i].w=it;\r\n\tfor(int i=1;i<=m;i++)\r\n\t{\r\n\t\tst[i]=it,ed[i]=it;\r\n\t\tiaq(st[i],ed[i]),iaq(ed[i],st[i]);\r\n\t}\r\n}\r\n\r\nvoid slv_work(void)\r\n{\r\n\ttarjan(1,1);\r\n\tfor(int i=1;i<=m;i++)\r\n\t{\r\n\t\tint x=st[i],y=ed[i],l=lca[i];\r\n\t\tint d=e[x].d+e[y].d-(e[l].d<<1);\r\n\t\taa.ad(x,e[x].d);\r\n\t\tba.ad(y,e[y].d-d);\r\n\t\tam.ad(l,e[x].d);\r\n\t\tbm.ad(l,e[y].d-d);\r\n\t\tif(e[x].d-e[l].d==e[l].w)\r\n\t\t\te[l].s++;\r\n\t}\r\n\tdfs(1,1);\r\n\tfor(int i=1;i<=n;i++)\r\n\t\txt.out(e[i].s);\r\n\tputchar('\\n');\r\n}\r\n\r\nvoid work(void)\r\n{\r\n\tpre_work();\r\n\tslv_work();\r\n}\r\n\r\nint main(int argc,char *argv[],char *env[])\r\n{\r\n\twork();\r\n\treturn 0;\r\n}\r\n", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpfk442crn/652f3bed-ea61-4d28-a54e-940245d8f562.cpp:5:38: warning: ‘-std=c++17’ is not an option that controls warnings [-Wpragmas]\n 5 | #pragma GCC diagnostic error \"-std=c++17\"\n | ^~~~~~~~~~~~\n/tmp/tmpfk442crn/652f3bed-ea61-4d28-a54e-940245d8f562.cpp:83:27: error: conflicting declaration ‘typedef long long int __int64_t’\n 83 | typedef long long __int64_t;\n | ^~~~~~~~~\nIn file included from /usr/include/stdio.h:38,\n from /usr/include/c++/11/cstdio:42,\n from /tmp/tmpfk442crn/652f3bed-ea61-4d28-a54e-940245d8f562.cpp:1:\n/usr/include/x86_64-linux-gnu/bits/types.h:44:25: note: previous declaration as ‘typedef long int __int64_t’\n 44 | typedef signed long int __int64_t;\n | ^~~~~~~~~\n" | |
| ], | |
| "tcb_id": "天天爱跑步" | |
| }, | |
| { | |
| "code_id": 0, | |
| "code": "#include<cstdio>\r\n#include<algorithm>\r\n#include<vector>\r\nusing namespace std;\r\ntypedef long double LD;\r\nconst int N=1012,M=100005;\r\nconst LD eps=1e-8;\r\nstruct node { LD A,B,C,K; } v[N];\r\nstruct node1 { LD x,y; int b1,b2; } P[N*N];\r\nstruct node2 { LD x,y; int b; } V[M];\r\nstruct node3 { LD x,y; } la[N];\r\nvector <int> Q[N];\r\nLD an[M],s[N],X,L,D;\r\nint d[N],fd[N],i,j,k,n,m,g,G,F;\r\nbool p[N];\r\nchar c;\r\n\r\ninline char getc()\r\n{\r\n\t#define VV 10000000\r\n\tstatic char s[VV],*l=s,*r=s;\r\n\tif (l==r)\r\n\t\tl=s,r=s+fread(s,1,VV,stdin);\r\n\treturn l==r?0:*l++;\r\n}\r\n\r\nint read(){ int z=0; do c=getchar(); while (c<'0'||c>'9'); while (c>='0'&&c<='9') z*=10,z+=c-'0',c=getchar(); return z; }\r\n\r\nbool same(LD A,LD B){ return fabs(A-B)<eps; }\r\n\r\nbool cmp(node1 a,node1 b){ return a.x<b.x||same(a.x,b.x)&&a.y<b.y; }\r\nbool cmp1(node2 a,node2 b){ return a.x<b.x||same(a.x,b.x)&&a.y<b.y; }\r\nbool cmpK(node a,node b)\r\n{\r\n\tif (same(a.K,b.K))\r\n\t{\r\n\t\tif (fabs(a.B)>eps)\r\n\t\t\treturn a.C/a.B<b.C/b.B;\r\n\t\telse\r\n\t\t\treturn a.C/a.A>b.C/b.A;\r\n\t}\r\n\treturn a.K<b.K;\r\n}\r\n\r\nvoid calc(node A,node B)\r\n{\r\n\tif (same(A.A*B.B,A.B*B.A))\r\n\t{\r\n\t\tp[i]=fabs(A.A)>eps?same(A.A*B.C,A.C*B.A):same(A.B*B.C,A.C*B.B);\r\n\t\treturn;\r\n\t}\r\n\tLD X=(A.B*B.C-A.C*B.B)/(A.A*B.B-B.A*A.B),\r\n\t Y=fabs(A.B)>eps?(-A.C-A.A*X)/A.B:(-B.C-B.A*X)/B.B;\r\n\t//printf(\"%d %d %Lf %Lf %Lf %Lf\\n\",j,i,X,Y,A.B*B.C-A.C*B.B,A.A*B.B-B.A*A.B);\r\n\t//if (-L<=X&&X<=L&&-L<=Y&&Y<=L)\r\n\t\tP[++g]=(node1){X,Y,j,i};\r\n}\r\n\r\nLD Calc(node A,LD x,LD y)\r\n{\r\n\treturn A.A*x+A.B*y+A.C;\r\n}\r\n\r\nint find(LD x,LD y)\r\n{\r\n\tint l=1,r=n;\r\n\twhile (l<r)\r\n\t{\r\n\t\tint mid=l+r+1>>1;\r\n\t\tif (Calc(v[d[mid]],x,y)<0) l=mid; else r=mid-1;\r\n\t}\r\n\treturn l;\r\n}\r\n\r\nvoid solve(int x)\r\n{\r\n\tfor (register int i=0;i<Q[x].size();++i)\r\n\t\tan[Q[x][i]]=s[x];\r\n\ts[x]=0,Q[x].clear();\r\n}\r\n\r\nLD cross(node1 A,node3 B)\r\n{\r\n\treturn A.x*B.y-A.y*B.x;\r\n}\r\n\r\nint main()\r\n{\r\n\tn=read(),m=read(),scanf(\"%Lf\",&L);\r\n\t//puts(\"C\");\r\n\tfor (i=1;i<=n;++i)\r\n\t{\r\n\t\tscanf(\"%Lf%Lf%Lf\",&v[i].A,&v[i].B,&v[i].C);\r\n\t\tif (fabs(v[i].B)<eps)\r\n\t\t{\r\n\t\t\tif (v[i].A<0)\r\n\t\t\t\tv[i].A*=-1,v[i].C*=-1;\r\n\t\t}\r\n\t\telse\r\n\t\t\tif (v[i].B<0)\r\n\t\t\t\tv[i].A*=-1,v[i].B*=-1,v[i].C*=-1;\r\n\t\tv[i].K=fabs(v[i].B)>eps?-v[i].A/v[i].B:1e30;\r\n\t}\r\n\tv[++n]=(node){0,1,L,0},v[++n]=(node){0,1,-L,0},\r\n\tv[++n]=(node){1,0,L,1e30},v[++n]=(node){1,0,-L,1e30};\r\n\tsort(v+1,v+n+1,cmpK);\r\n\t//for (i=1;i<=n;++i) printf(\"%d %Lf %Lf %Lf %Lf\\n\",i,v[i].A,v[i].B,v[i].C,v[i].K);\r\n\t\r\n\tfor (i=1;i<=m;++i) scanf(\"%Lf%Lf\",&V[i].x,&V[i].y),V[i].b=i;\r\n\tsort(V+1,V+m+1,cmp1),V[m+1].x=1e60;\r\n\t\r\n\tfor (i=1;i<=n;++i)\r\n\t\tfor (j=1;j<i;++j)\r\n\t\t\tif (!p[j])\r\n\t\t\t{\r\n\t\t\t\tcalc(v[j],v[i]);\r\n\t\t\t\tif (p[i]) break;\r\n\t\t\t}\r\n\tfor (i=1;i<=n;++i)\r\n\t\tif (!p[i])\r\n\t\t\tv[++F]=v[i];\r\n\tn=F;\r\n\tsort(P+1,P+g+1,cmp);\r\n\t//for (i=1;i<=g;++i) printf(\"%d %Lf %Lf %d %d\\n\",i,P[i].x,P[i].y,P[i].b1,P[i].b2);\r\n\tfor (i=1;i<=n;++i) d[i]=fd[i]=i;\r\n\tfor (j=i=1;i<=g;++i)\r\n\t{\r\n\t\t//printf(\"%d:\\n\",i);\r\n\t\twhile (V[j].x<P[i].x||V[j].x==P[i].x&&V[j].y<P[i].y)\r\n\t\t{\r\n\t\t\t//printf(\"%d \",j);\r\n\t\t\tint x=find(V[j].x,V[j].y);\r\n\t\t\tQ[x].push_back(V[j].b);\r\n\t\t\t++j;\r\n\t\t}\r\n\t\t//puts(\"\");\r\n\t\tint x=fd[P[i].b1],y=fd[P[i].b2];\r\n\t\tLD s1=cross(P[i],la[x]),s2=-cross(P[i],la[y]);\r\n\t\ts[x]+=s1+s2,\r\n\t\ts[x-1]-=s1,\r\n\t\ts[y]-=s2,\r\n\t\tsolve(x),\r\n\t\tla[x].x=la[y].x=P[i].x,\r\n\t\tla[x].y=la[y].y=P[i].y,\r\n\t\tswap(d[x],d[y]),\r\n\t\tfd[d[x]]=x,\r\n\t\tfd[d[y]]=y;\r\n\t}\r\n\tfor (i=1;i<=m;++i) printf(\"%.2Lf\\n\",an[i]/2);\r\n\treturn 0;\r\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp: In function ‘bool same(LD, LD)’:\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp:29:30: error: ‘fabs’ was not declared in this scope; did you mean ‘labs’?\n 29 | bool same(LD A,LD B){ return fabs(A-B)<eps; }\n | ^~~~\n | labs\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp: In function ‘bool cmpK(node, node)’:\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp:37:21: error: ‘fabs’ was not declared in this scope; did you mean ‘labs’?\n 37 | if (fabs(a.B)>eps)\n | ^~~~\n | labs\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp: In function ‘void calc(node, node)’:\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp:49:22: error: ‘fabs’ was not declared in this scope; did you mean ‘labs’?\n 49 | p[i]=fabs(A.A)>eps?same(A.A*B.C,A.C*B.A):same(A.B*B.C,A.C*B.B);\n | ^~~~\n | labs\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp:53:14: error: ‘fabs’ was not declared in this scope; did you mean ‘labs’?\n 53 | Y=fabs(A.B)>eps?(-A.C-A.A*X)/A.B:(-B.C-B.A*X)/B.B;\n | ^~~~\n | labs\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp: In function ‘int main()’:\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp:94:21: error: ‘fabs’ was not declared in this scope; did you mean ‘labs’?\n 94 | if (fabs(v[i].B)<eps)\n | ^~~~\n | labs\n/tmp/tmphsm32reu/ca787cb5-4c3d-421c-89d5-7dfffe5169e2.cpp:102:24: error: ‘fabs’ was not declared in this scope; did you mean ‘labs’?\n 102 | v[i].K=fabs(v[i].B)>eps?-v[i].A/v[i].B:1e30;\n | ^~~~\n | labs\n" | |
| ], | |
| "tcb_id": "寄蒜几盒" | |
| }, | |
| { | |
| "code_id": 0, | |
| "code": "#include <bits/stdc++.h>\n#ifndef ONLINE_JUDGE\n#include \"lib.h\"\n#endif\n#define rep(i, min, max) for(int i = (min); i <= (max); ++i)\n#define nrep(i, max, min) for(int i = (max); i >= (min); --i)\n#define reads(str) (scanf(\"%s\", str + 1), strlen(str + 1))\n#define case() int Ts = read(); rep(T, 1, Ts)\n#define putf(flag) puts((flag) ? \"YES\" : \"NO\")\n#define put(x) printf(\"%d \", x)\n#define putl(x) printf(\"%lld \", x)\n#define endl() putchar('\\n')\nusing namespace std;\n\ntypedef long long ll;\ninline int read()\n{\n int now=0; bool nev=false; char c=getchar();\n while(c<'0' || c>'9') { if(c=='-') nev=true; c=getchar(); }\n while(c>='0' && c<='9') { now=(now<<1)+(now<<3)+(c&15); c=getchar(); }\n return nev?-now:now;\n}\n\nconst int N = 1e6 + 10, K = 15;\nconst ll mod = 1e9 + 7;\n\nll fpow(ll x, ll k) { ll r = 1; while(k) { if(k & 1) r = r * x % mod; x = x * x % mod; k >>= 1;} return r;}\n\nint n, k;\nll w[K], cur[K], mx[K], mn[K];\nll _cur[K], _mx[K], _mn[K];\nll p[N], v[N];\nll sum = 1, ans;\nll x[K], y[K];\nstruct Poly {\n ll a[K];\n Poly() { memset(a, 0, sizeof(ll) * (k + 1)); }\n void init() { memset(a, 0, sizeof(ll) * (k + 1)); a[0] = 1; }\n Poly mul(ll x, ll y) {\n Poly res;\n rep(i, 0, k) (res.a[i + 1] += a[i] * x) %= mod;\n rep(i, 0, k) (res.a[i] += a[i] * y) %= mod;\n return res;\n }\n Poly operator + (const Poly &b) const {\n Poly res;\n rep(i, 0, k) res.a[i] = (a[i] + b.a[i]) % mod;\n return res;\n }\n ll calc(ll x) {\n ll pw = 1, res = 0;\n rep(i, 0, k) (res += pw * a[i]) %= mod, pw = pw * x % mod;\n return res;\n }\n} all, now;\n\ninline ll get(int p) { return w[p] - mx[p] - -mn[p]; }\ninline ll _get(int p) { return w[p] - _mx[p] - -_mn[p]; }\n\nint main() {\n freopen(\"walk.in\", \"r\", stdin);\n freopen(\"walk.out\", \"w\", stdout);\n\n n = read(), k = read();\n rep(i, 1, k) w[i] = read(), sum = sum * w[i] % mod;\n (ans += sum) %= mod;\n rep(i, 1, n) p[i] = read(), v[i] = read();\n rep(i, 1, n) {\n ll p = ::p[i], v = ::v[i];\n ll last = get(p);\n cur[p] += v;\n mx[p] = max(mx[p], cur[p]);\n mn[p] = min(mn[p], cur[p]);\n ll now = get(p);\n if(now <= 0) putl(ans), exit(0);\n sum = 1;\n rep(j, 1, k) sum = sum * get(j) % mod;\n (ans += sum) %= mod;\n }\n ll turn = 1e9; bool fl = 0;\n rep(i, 1, k) if(cur[i] != 0) turn = min(turn, get(i) / abs(cur[i])), fl = 1;\n if(!fl) putl(-1), exit(0);\n if(turn > 0) {\n rep(i, 1, k) _cur[i] = cur[i], _mx[i] = mx[i], _mn[i] = mn[i];\n rep(i, 1, k) x[i] = -abs(cur[i]), y[i] = _get(i);//, print(i, x[i], y[i]);\n rep(i, 1, n) {\n ll p = ::p[i], v = ::v[i];\n _cur[p] += v;\n _mx[p] = max(_mx[p], _cur[p]);\n _mn[p] = min(_mn[p], _cur[p]);\n y[p] = _get(p);\n now.init();\n rep(i, 1, k) now = now.mul(x[i], y[i]);\n all = all + now;\n // parray(all.a, k + 1, 0);\n }\n rep(t, 0, turn - 1) (ans += all.calc(t)) %= mod;//, print(t, all.calc(t));\n rep(i, 1, k) {\n mx[i] += max(0ll, turn * cur[i]);\n mn[i] += min(0ll, turn * cur[i]);\n cur[i] += turn * cur[i];\n }\n }\n rep(i, 1, n) {\n ll p = ::p[i], v = ::v[i];\n ll last = get(p);\n cur[p] += v;\n mx[p] = max(mx[p], cur[p]);\n mn[p] = min(mn[p], cur[p]);\n ll now = get(p);\n if(now <= 0) putl(ans), exit(0);\n sum = 1;\n rep(j, 1, k) sum = sum * get(j) % mod;\n (ans += sum) %= mod;\n }\n putl(ans);\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpy1l29zh_/8e25a033-72d9-4a9f-be52-e05b1be37100.cpp:3:10: fatal error: lib.h: No such file or directory\n 3 | #include \"lib.h\"\n | ^~~~~~~\ncompilation terminated.\n" | |
| ], | |
| "tcb_id": "微信步数" | |
| }, | |
| { | |
| "code_id": 1, | |
| "code": "#define p(x) scanf(\"%d\",&x);\nf[1001],n,x,y;main(i,j){p(n)while(i++<n){p(x)p(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "cc1plus: warning: command-line option ‘-std=c11’ is valid for C/ObjC but not for C++\n/tmp/tmpyjsete10/c7f62635-27e3-45bf-9d08-cbb8ce1c7815.cpp:2:1: error: ‘f’ does not name a type\n 2 | f[1001],n,x,y;main(i,j){p(n)while(i++<n){p(x)p(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpyjsete10/c7f62635-27e3-45bf-9d08-cbb8ce1c7815.cpp:2:19: error: expected constructor, destructor, or type conversion before ‘(’ token\n 2 | f[1001],n,x,y;main(i,j){p(n)while(i++<n){p(x)p(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n" | |
| ], | |
| "tcb_id": "扑克牌" | |
| }, | |
| { | |
| "code_id": 2, | |
| "code": "#define o(x) scanf(\"%d\",&x);\nn,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "cc1plus: warning: command-line option ‘-std=c11’ is valid for C/ObjC but not for C++\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:1: error: ‘n’ does not name a type\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:18: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^~~~\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp: In function ‘int main()’:\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:27: error: ‘n’ was not declared in this scope\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:1:26: note: in definition of macro ‘o’\n 1 | #define o(x) scanf(\"%d\",&x);\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:1:14: error: ‘scanf’ was not declared in this scope\n 1 | #define o(x) scanf(\"%d\",&x);\n | ^~~~~\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:25: note: in expansion of macro ‘o’\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:33: error: ‘i’ was not declared in this scope\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:48: error: ‘x’ was not declared in this scope\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:1:26: note: in definition of macro ‘o’\n 1 | #define o(x) scanf(\"%d\",&x);\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:52: error: ‘y’ was not declared in this scope\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:1:26: note: in definition of macro ‘o’\n 1 | #define o(x) scanf(\"%d\",&x);\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:58: error: ‘j’ was not declared in this scope\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:71: error: ‘f’ was not declared in this scope\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:114: error: ‘f’ was not declared in this scope\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:2:102: error: ‘printf’ was not declared in this scope\n 2 | n,i,j,x,y,f[999];main(){o(n)for(i=0;++i<=n;){o(x)o(y)for(j=n;j>=x;--j)f[j-x]+y>f[j]?f[j]=f[j-x]+y:1;}printf(\"%d\",f[n]);}\n | ^~~~~~\n/tmp/tmpmd08tjfc/533f3e18-8c1e-426e-bfaf-6ce2404cf14f.cpp:1:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?\n +++ |+#include <cstdio>\n 1 | #define o(x) scanf(\"%d\",&x);\n" | |
| ], | |
| "tcb_id": "扑克牌" | |
| }, | |
| { | |
| "code_id": 17, | |
| "code": "#include<cstdio>\r\n#include<cctype>\r\n\r\n#ifdef __GNUG__\r\n\t#pragma GCC diagnostic error \"-std=c++17\"\r\n#endif\r\n\r\n#ifdef __GNUG__\r\n\t#pragma GCC optimize(\"O3\")\r\n#endif\r\n\r\n#ifdef __linux\r\n\t#define getchar getchar_unlocked\r\n\t#define putchar putchar_unlocked\r\n#endif\r\n\r\ntemplate<typename ut>\r\nclass iopv\r\n{\r\npublic:\r\n\tvoid out(ut);\r\n\toperator ut(void);\r\npublic:\r\n\tiopv(void);\r\n\t~iopv(void);\r\n};\r\n\r\ntemplate<typename ut>\r\ninline\r\niopv<ut>::iopv(void)\r\n{\r\n}\r\n\r\ntemplate<typename ut>\r\ninline\r\niopv<ut>::~iopv(void)\r\n{\r\n}\r\n\r\ntemplate<typename ut>\r\ninline\r\niopv<ut>::operator ut(void)\r\n{\r\n\tchar s='#';\r\n\tut x=0,fg=0;\r\n\twhile(!isdigit(s))\r\n\t{\r\n\t\tfg|=s=='-';\r\n\t\ts=getchar();\r\n\t}\r\n\twhile(isdigit(s))\r\n\t{\r\n\t\tx=x*10+s-'0';\r\n\t\ts=getchar();\r\n\t}\r\n\treturn fg?-x:x;\r\n}\r\n\r\ntemplate<typename ut>\r\ninline\r\nvoid iopv<ut>::out(ut x)\r\n{\r\n\tstatic char z[20]={};\r\n\tchar *i=z;\r\n\tif(!x)\r\n\t\tputchar('0');\r\n\telse\r\n\t{\r\n\t\tif(x<0)\r\n\t\t\tputchar('-'),x=-x;\r\n\t\twhile(x)\r\n\t\t{\r\n\t\t\tut y=x/10;\r\n\t\t\t*i++=x-y*10+'0',x=y;\r\n\t\t}\r\n\t\twhile(i!=z)\r\n\t\t\tputchar(*--i);\r\n\t}\r\n\tputchar('\\n');\r\n}\r\n\r\niopv<int>it;\r\n\r\n#ifdef __linux\r\n\ttypedef long long __int64_t;\r\n#endif\r\n\r\nconst int __l=12;\r\n\r\nint seq[5+(1<<__l)],n=0,fac[__l]={};\r\n__int64_t res=0;\r\n\r\nvoid prev_work(void)\r\n{\r\n\tn=it;\r\n\tfor(int i=1;i<=1<<n;i++)\r\n\t\tseq[i]=it;\r\n\tfac[0]=1;\r\n\tfor(int i=1;i<=n;i++)\r\n\t\tfac[i]=fac[i-1]*i;\r\n}\r\n\r\nbool inc(int s,int k)\r\n{\r\n\tfor(int i=1;i!=1<<k;i++)\r\n\t\tif(seq[s+i]!=seq[s+i-1]+1)\r\n\t\t\treturn false;\r\n\treturn true;\r\n}\r\n\r\n#include<algorithm>\r\nvoid swap_seq(int x,int y,int k)\r\n{\r\n\tfor(int i=0;i!=1<<k;i++)\r\n\t\tstd::swap(seq[x+i],seq[y+i]);\r\n\treturn;\r\n}\r\n\r\nvoid dfs(int k,int c)\r\n{\r\n\tif(k>n)\r\n\t{\r\n\t\tres+=fac[c];\r\n\t\treturn;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tint z1=0,z2=0;\r\n\t\tfor(int i=1;i<=1<<n;i+=1<<k)\r\n\t\t\tif(!inc(i,k))\r\n\t\t\t\tif(!z1)\r\n\t\t\t\t\tz1=i;\r\n\t\t\t\telse\r\n\t\t\t\tif(!z2)\r\n\t\t\t\t\tz2=i;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn;\r\n\t\tif(!z1&&!z2)\r\n\t\t\tdfs(k+1,c);\r\n\t\telse\r\n\t\tif(z1&&!z2)\r\n\t\t{\r\n\t\t\tswap_seq(z1,z1+(1<<(k-1)),k-1);\r\n\t\t\tdfs(k+1,c+1);\r\n\t\t\tswap_seq(z1,z1+(1<<(k-1)),k-1);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tfor(int i=0;i<=1;i++)\r\n\t\t\t\tfor(int j=0;j<=1;j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tswap_seq(z1+i*(1<<(k-1)),z2+j*(1<<(k-1)),k-1);\r\n\t\t\t\t\tif(inc(z1,k)&&inc(z2,k))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdfs(k+1,c+1);\r\n\t\t\t\t\t\tswap_seq(z1+i*(1<<(k-1)),z2+j*(1<<(k-1)),k-1);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tswap_seq(z1+i*(1<<(k-1)),z2+j*(1<<(k-1)),k-1);\r\n\t\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid work(void)\r\n{\r\n\tprev_work();\r\n\tdfs(1,0);\r\n\tit.out(res);\r\n}\r\n\r\nint main(int argc,char *argv[],char *env[])\r\n{\r\n\twork();\r\n\treturn 0;\r\n}\r\n", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmp7u0507jj/3c95c7ce-f39a-427c-975e-47a17215219c.cpp:5:38: warning: ‘-std=c++17’ is not an option that controls warnings [-Wpragmas]\n 5 | #pragma GCC diagnostic error \"-std=c++17\"\n | ^~~~~~~~~~~~\n/tmp/tmp7u0507jj/3c95c7ce-f39a-427c-975e-47a17215219c.cpp:85:27: error: conflicting declaration ‘typedef long long int __int64_t’\n 85 | typedef long long __int64_t;\n | ^~~~~~~~~\nIn file included from /usr/include/stdio.h:38,\n from /usr/include/c++/11/cstdio:42,\n from /tmp/tmp7u0507jj/3c95c7ce-f39a-427c-975e-47a17215219c.cpp:1:\n/usr/include/x86_64-linux-gnu/bits/types.h:44:25: note: previous declaration as ‘typedef long int __int64_t’\n 44 | typedef signed long int __int64_t;\n | ^~~~~~~~~\n" | |
| ], | |
| "tcb_id": "排序" | |
| }, | |
| { | |
| "code_id": 5, | |
| "code": "/**\r\n * code generated by JHelper\r\n * More info: https://github.com/AlexeyDmitriev/JHelper\r\n * @author GYSHGX868\r\n */\r\n\r\n#include <fstream>\r\n#include <iostream>\r\n\r\n\r\n\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n\r\nclass InputReader {\r\n public:\r\n explicit InputReader(std::istream& stream) : stream(stream) {\r\n stream.tie(nullptr);\r\n }\r\n\r\n bool has_next() const {\r\n return !stream.eof();\r\n }\r\n\r\n int get_char() {\r\n return stream.get();\r\n }\r\n\r\n std::string get_line() {\r\n std::string result;\r\n std::getline(stream, result);\r\n return result;\r\n }\r\n\r\n template <class T>\r\n T next() {\r\n T value;\r\n stream >> value;\r\n return value;\r\n }\r\n\r\n template <class T>\r\n std::vector<T> next_array(std::size_t size) {\r\n std::vector<T> result(size);\r\n for (std::size_t i = 0; i < size; i++) {\r\n result[i] = next<T>();\r\n }\r\n return result;\r\n }\r\n\r\n int next_int() {\r\n return next<int>();\r\n }\r\n\r\n long long next_long() {\r\n return next<long long>();\r\n }\r\n\r\n float next_float() {\r\n return next<float>();\r\n }\r\n\r\n double next_double() {\r\n return next<double>();\r\n }\r\n\r\n std::string next_string() {\r\n return next<std::string>();\r\n }\r\n\r\n std::vector<int> next_int_array(std::size_t size) {\r\n return next_array<int>(size);\r\n }\r\n\r\n std::vector<long long> next_long_array(std::size_t size) {\r\n return next_array<long long>(size);\r\n }\r\n\r\n std::vector<float> next_float_array(std::size_t size) {\r\n return next_array<float>(size);\r\n }\r\n\r\n std::vector<double> next_double_array(std::size_t size) {\r\n return next_array<double>(size);\r\n }\r\n\r\n private:\r\n std::istream& stream;\r\n};\r\n\r\ntemplate <class T>\r\nInputReader& operator >>(InputReader& in, T& value) {\r\n value = in.next<T>();\r\n return in;\r\n}\r\n\r\n\r\n\r\n#include <iomanip>\r\n\r\n#include <type_traits>\r\n#include <utility>\r\n\r\n\r\nclass OutputWriter {\r\n public:\r\n explicit OutputWriter(std::ostream& stream) : stream(stream) {\r\n separator = ' ';\r\n }\r\n\r\n void set_separator(char s) {\r\n separator = s;\r\n }\r\n\r\n void set_precision(int n) {\r\n stream << std::fixed << std::setprecision(n);\r\n }\r\n\r\n template <class T, class... Args>\r\n void print(const T& first, const Args... args) {\r\n print_single(first);\r\n if (sizeof...(args) != 0) {\r\n stream << separator;\r\n print(args...);\r\n }\r\n }\r\n\r\n template <class... Args>\r\n void print_line(const Args... args) {\r\n print(args...);\r\n stream << '\\n';\r\n }\r\n\r\n private:\r\n std::ostream& stream;\r\n char separator;\r\n\r\n void print() {\r\n }\r\n\r\n template <class T>\r\n void print_single(const T& value) {\r\n stream << value;\r\n }\r\n\r\n template <class T>\r\n void print_single(const std::vector<T>& array) {\r\n std::size_t n = array.size();\r\n for (std::size_t i = 0; i < n; i++) {\r\n stream << array[i];\r\n if (i + 1 != n) {\r\n stream << separator;\r\n }\r\n }\r\n }\r\n};\r\n\r\n\r\n\r\n#include <stdexcept>\r\n\r\nclass BaseEdge {\r\n public:\r\n static constexpr bool reversible = false;\r\n std::size_t to;\r\n std::size_t id;\r\n\r\n BaseEdge(std::size_t to, std::size_t id) : to(to), id(id) {\r\n }\r\n\r\n BaseEdge reverse_edge(std::size_t) {\r\n throw std::runtime_error(\"Unsupported operation exception\");\r\n }\r\n\r\n void set_reverse_id(std::size_t) {\r\n throw std::runtime_error(\"Unsupported operation exception\");\r\n }\r\n};\r\n\r\n\r\n\r\n#include <functional>\r\n#include <queue>\r\n#include <unordered_map>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\ntemplate <class Edge>\r\nclass Graph {\r\n public:\r\n using edge_t = Edge;\r\n\r\n explicit Graph(std::size_t vertex_count) : vertex_count(vertex_count) {\r\n edges.resize(vertex_count, std::vector<edge_t>());\r\n }\r\n\r\n template <class... Ts>\r\n std::size_t add_edge(std::size_t from, std::size_t to, Ts... args) {\r\n if (from >= vertex_count || to >= vertex_count) {\r\n throw std::runtime_error(\"Out of bounds\");\r\n }\r\n edges[from].emplace_back(to, edge_count, args...);\r\n std::size_t direct_id = edges[from].size() - 1;\r\n if (edge_t::reversible) {\r\n edges[to].push_back(edges[from][direct_id].reverse_edge(from));\r\n std::size_t reverse_id = edges[to].size() - 1;\r\n edges[from][direct_id].set_reverse_id(reverse_id);\r\n edges[to][reverse_id].set_reverse_id(direct_id);\r\n }\r\n edge_count++;\r\n return direct_id;\r\n }\r\n\r\n std::vector<edge_t>& operator [](std::size_t index) {\r\n return edges[index];\r\n }\r\n\r\n const std::vector<edge_t>& operator [](std::size_t index) const {\r\n return edges[index];\r\n }\r\n\r\n void add_vertices(int count) {\r\n vertex_count += count;\r\n edges.resize(vertex_count);\r\n }\r\n\r\n void clear() {\r\n edge_count = 0;\r\n for (std::size_t i = 0; i < vertex_count; i++) {\r\n edges[i].clear();\r\n }\r\n }\r\n\r\n std::size_t num_vertices() const {\r\n return vertex_count;\r\n }\r\n\r\n std::size_t num_edges() const {\r\n return edge_count;\r\n }\r\n\r\n private:\r\n std::size_t vertex_count;\r\n std::size_t edge_count = 0;\r\n std::vector<std::vector<edge_t>> edges;\r\n};\r\n\r\n\r\ntemplate <class Edge>\r\nstd::size_t hopcroft_karp(const Graph<Edge>& graph, std::size_t left_size) {\r\n std::size_t min_distance;\r\n std::unordered_map<std::size_t, bool> used;\r\n std::unordered_map<std::size_t, std::size_t> left_dist;\r\n std::unordered_map<std::size_t, std::size_t> right_dist;\r\n std::unordered_map<std::size_t, std::size_t> left_match;\r\n std::unordered_map<std::size_t, std::size_t> right_match;\r\n auto match = [&]() -> bool {\r\n std::queue<std::size_t> queue;\r\n min_distance = std::numeric_limits<std::size_t>::max();\r\n for (std::size_t i = 0; i < left_size; i++) {\r\n if (left_match.find(i) == left_match.end()) {\r\n queue.push(i);\r\n left_dist[i] = 0;\r\n }\r\n }\r\n while (!queue.empty()) {\r\n std::size_t current = queue.front();\r\n queue.pop();\r\n if (left_dist[current] > min_distance) {\r\n break;\r\n }\r\n for (const auto& edge : graph[current]) {\r\n std::size_t next = edge.to;\r\n if (right_dist.find(next) == right_dist.end()) {\r\n right_dist[next] = left_dist[current] + 1;\r\n if (right_match.find(next) == right_match.end()) {\r\n min_distance = right_dist[next];\r\n } else {\r\n left_dist[right_match[next]] = right_dist[next] + 1;\r\n queue.push(right_match[next]);\r\n }\r\n }\r\n }\r\n }\r\n return min_distance != std::numeric_limits<std::size_t>::max();\r\n };\r\n std::function<bool(std::size_t)> dfs = [&](std::size_t current) -> bool {\r\n for (const auto& edge : graph[current]) {\r\n std::size_t next = edge.to;\r\n if (!used[next] && right_dist[next] == left_dist[current] + 1) {\r\n used[next] = true;\r\n if (right_match.find(next) != right_match.end() &&\r\n right_dist[next] == min_distance) {\r\n continue;\r\n }\r\n if (right_match.find(next) == right_match.end() ||\r\n dfs(right_match[next])) {\r\n right_match[next] = current;\r\n left_match[current] = next;\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n\r\n std::size_t result = 0;\r\n while (match()) {\r\n std::unordered_map<std::size_t, bool>().swap(used);\r\n for (std::size_t i = 0; i < left_size; i++) {\r\n if (left_match.find(i) == left_match.end() && dfs(i)) {\r\n result++;\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n\r\nclass HopcroftKarp {\r\n public:\r\n explicit HopcroftKarp(int left, int right) {\r\n left_size = left;\r\n right_size = right;\r\n link.resize(left_size);\r\n vis.resize(right_size);\r\n match_x.resize(left);\r\n match_y.resize(right);\r\n dist_x.resize(left);\r\n dist_y.resize(right);\r\n }\r\n\r\n void add_link(int u, int v) { link[u].push_back(v); }\r\n\r\n int solve() {\r\n int max_match = 0;\r\n std::fill(match_x.begin(), match_x.end(), -1);\r\n std::fill(match_y.begin(), match_y.end(), -1);\r\n while (match()) {\r\n std::fill(vis.begin(), vis.end(), 0);\r\n for (int i = 0; i < left_size; i++) {\r\n if (match_x[i] == -1 && dfs(i)) { max_match++; }\r\n }\r\n }\r\n return max_match;\r\n }\r\n\r\n private:\r\n int left_size, right_size;\r\n int min_dist;\r\n std::vector<int> vis;\r\n std::vector<std::vector<int> > link;\r\n std::vector<int> match_x, match_y;\r\n std::vector<int> dist_x, dist_y;\r\n\r\n bool match() {\r\n std::queue<int> q;\r\n min_dist = std::numeric_limits<int>::max();\r\n std::fill(dist_x.begin(), dist_x.end(), -1);\r\n std::fill(dist_y.begin(), dist_y.end(), -1);\r\n for (int i = 0; i < left_size; i++) { //\r\n if (match_x[i] == -1) {\r\n q.push(i);\r\n dist_x[i] = 0;\r\n }\r\n }\r\n while (!q.empty()) {\r\n int u = q.front();\r\n q.pop();\r\n if (dist_x[u] > min_dist) { break; }\r\n for (int i = 0; i < link[u].size(); i++) {\r\n int v = link[u][i];\r\n if (dist_y[v] == -1) {\r\n dist_y[v] = dist_x[u] + 1;\r\n if (match_y[v] == -1) {\r\n min_dist = dist_y[v];\r\n } else {\r\n dist_x[match_y[v]] = dist_y[v] + 1;\r\n q.push(match_y[v]);\r\n }\r\n }\r\n }\r\n }\r\n return min_dist != std::numeric_limits<int>::max();\r\n }\r\n\r\n bool dfs(int u) {\r\n for (int i = 0; i < link[u].size(); i++) {\r\n int v = link[u][i];\r\n if (vis[v] == 0 && dist_y[v] == dist_x[u] + 1) {\r\n vis[v] = 1;\r\n if (match_y[v] != -1 && dist_y[v] == min_dist) { continue; }\r\n if (match_y[v] == -1 || dfs(match_y[v])) {\r\n match_y[v] = u;\r\n match_x[u] = v;\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n};\r\n\r\nclass LOJ6000 {\r\n public:\r\n void solve(InputReader& in, OutputWriter& out) {\r\n /*\r\n int n = in.next_int();\r\n int m = in.next_int();\r\n Graph<BaseEdge> graph(n);\r\n while (in.has_next()) {\r\n int x = in.next_int() - 1;\r\n int y = in.next_int() - 1;\r\n graph.add_edge(x, y);\r\n }\r\n auto answer = hopcroft_karp(graph, n - m);\r\n out.print_line(answer);\r\n */\r\n int n = in.next_int();\r\n int m = in.next_int();\r\n HopcroftKarp hk(n - m, m);\r\n while (in.has_next()) {\r\n int x = in.next_int() - 1;\r\n int y = in.next_int() - m - 1;\r\n hk.add_link(x, y);\r\n }\r\n out.print_line(hk.solve());\r\n }\r\n};\r\n\r\n\r\nint main() {\r\n std::ios::sync_with_stdio(false);\r\n LOJ6000 solver;\r\n InputReader in(std::cin);\r\n OutputWriter out(std::cout);\r\n solver.solve(in, out);\r\n return 0;\r\n}\r\n", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp: In lambda function:\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:264:25: error: ‘numeric_limits’ is not a member of ‘std’\n 264 | min_distance = std::numeric_limits<std::size_t>::max();\n | ^~~~~~~~~~~~~~\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:264:51: error: expected primary-expression before ‘>’ token\n 264 | min_distance = std::numeric_limits<std::size_t>::max();\n | ^\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:264:54: error: ‘::max’ has not been declared; did you mean ‘std::max’?\n 264 | min_distance = std::numeric_limits<std::size_t>::max();\n | ^~~\n | std::max\nIn file included from /usr/include/c++/11/functional:65,\n from /tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:183:\n/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here\n 3467 | max(initializer_list<_Tp> __l, _Compare __comp)\n | ^~~\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:290:33: error: ‘numeric_limits’ is not a member of ‘std’\n 290 | return min_distance != std::numeric_limits<std::size_t>::max();\n | ^~~~~~~~~~~~~~\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:290:59: error: expected primary-expression before ‘>’ token\n 290 | return min_distance != std::numeric_limits<std::size_t>::max();\n | ^\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:290:62: error: ‘::max’ has not been declared; did you mean ‘std::max’?\n 290 | return min_distance != std::numeric_limits<std::size_t>::max();\n | ^~~\n | std::max\nIn file included from /usr/include/c++/11/functional:65,\n from /tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:183:\n/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here\n 3467 | max(initializer_list<_Tp> __l, _Compare __comp)\n | ^~~\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp: In member function ‘bool HopcroftKarp::match()’:\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:363:21: error: ‘numeric_limits’ is not a member of ‘std’\n 363 | min_dist = std::numeric_limits<int>::max();\n | ^~~~~~~~~~~~~~\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:363:36: error: expected primary-expression before ‘int’\n 363 | min_dist = std::numeric_limits<int>::max();\n | ^~~\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:389:29: error: ‘numeric_limits’ is not a member of ‘std’\n 389 | return min_dist != std::numeric_limits<int>::max();\n | ^~~~~~~~~~~~~~\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:389:44: error: expected primary-expression before ‘int’\n 389 | return min_dist != std::numeric_limits<int>::max();\n | ^~~\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:389:44: error: expected ‘;’ before ‘int’\n/tmp/tmph4pibpbr/0ebb2e33-490a-48b7-9ada-93b6210ff227.cpp:389:47: error: expected unqualified-id before ‘>’ token\n 389 | return min_dist != std::numeric_limits<int>::max();\n | ^\n" | |
| ], | |
| "tcb_id": "搭配飞行员" | |
| }, | |
| { | |
| "code_id": 8, | |
| "code": "#include<bits/stdc++.h>\nusing namespace std;\ntemplate<typename T>void re(T &i){\n\ti=0;int f=1;char c=getchar();\n\tfor(;!isdigit(c);c=getchar()) if(c=='-') f=-1;\n\tfor(;isdigit(c);c=getchar()) i=i*10+(c^48);\n\ti*=f;\n}\n//const int N=1e4,M=1e5;\nconst int N=3e3+33,M=6e3+33;\nint n,m;\nint link[N][N];\nint halo[N];\nbool cmp(int a,int b) {return halo[a]<halo[b];}\nstruct node{\n\tint y,id;\n\tnode(int yy=0,int ii=0) {y=yy;id=ii;}\n};\nvector<node>v[N];\nint as[23333];\nbool vis[N];int dfn[N],low[N];\nstruct E{\n\tint x,y;\n\tE(int xx=0,int yy=0) {x=xx;y=yy;}\n}ed[M];\nint in[N];\nnamespace TP{\n\tint tot;\n\tint nm;\n\tint st[N],tp;\n\tint fir[N],nxt[M],to[M];\n\tint du[N],qu[N];\n\tbool ok[N][N];\n\tint binx[M],biny[M];\n\tvoid pre(){\n\t\twhile(tot){\n\t\t\tok[binx[tot]][biny[tot]]=0;--tot;\n\t\t}\n\t\tmemset(fir,0,sizeof(fir));\n\t\tmemset(du,0,sizeof(du));\n\t\tmemset(qu,0,sizeof(qu));\n\t}\n\tvoid addedge(int x,int y) {if(ok[x][y]) return;ok[x][y]=1;++tot;binx[tot]=x;biny[tot]=y;nxt[tot]=fir[x];fir[x]=tot;to[tot]=y;++du[y];}\n\tvoid solve(){\n\t\ttp=0;\n\t\tfor(int i=1;i<=nm;++i) if(!du[i]){\n\t\t\tst[++tp]=i;\n\t\t}\n\t\twhile(tp){\n\t\t\tint x=st[tp--];\n\t\t\tfor(int e=fir[x];e;e=nxt[e]){\n\t\t\t\tint y=to[e];\n\t\t\t\tqu[y]+=qu[x];\n\t\t\t\tif(!--du[y]) st[++tp]=y;\n\t\t\t}\n\t\t}\n\t}\n}\nnamespace S{\n\tint tot;\n\tint fir[N],nxt[M],to[M];\n\tvoid addedge(int x,int y) {nxt[++tot]=fir[x];fir[x]=tot;to[tot]=y;}\n\tint st[N],tp;\n\tvoid solve(int s){\n\t\tif(s==1){\n\t\t\thalo[s]=n-1;\n\t\t\treturn;\n\t\t}\n\t\tst[tp=1]=1;link[s][s]=link[s][1]=1;\n\t\twhile(tp){\n\t\t\tint x=st[tp--];\n\t\t\tfor(int e=fir[x];e;e=nxt[e]){\n\t\t\t\tint y=to[e];\n\t\t\t\tif(!link[s][y]){\n\t\t\t\t\tst[++tp]=y;link[s][y]=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=1;i<=n;++i) if(i!=s&&!link[s][i]) ++halo[s];\n\t}\n\tint cnt;int nm;\n\tint id[N];\n\tvoid Dfs(int x){\n\t\tst[++tp]=x;in[x]=true;dfn[x]=low[x]=++cnt;\n\t\tfor(int e=fir[x];e;e=nxt[e]){\n\t\t\tint y=to[e];\n\t\t\tif(vis[y]) continue;\n\t\t\tif(!dfn[y]){\n\t\t\t\tDfs(y);\n\t\t\t\tlow[x]=min(low[x],low[y]);\n\t\t\t}\n\t\t\telse if(in[y]) low[x]=min(low[x],dfn[y]);\n\t\t}\n\t\tif(dfn[x]==low[x]){\n\t\t\t++nm;\n\t\t\twhile(st[tp]!=x){\n\t\t\t\tid[st[tp]]=nm;\n\t\t\t\tin[st[tp--]]=false;\n\t\t\t}\n\t\t\t--tp;id[x]=nm;in[x]=false;\n\t\t}\n\t}\n\tvoid nddsfsdf(int s){\n\t\tif(!v[s].size()) return;\n\t\tmemset(vis,0,sizeof(vis));\n\t\tmemset(dfn,0,sizeof(dfn));\n\t\tcnt=0;nm=0;\n\t\tfor(int i=1;i<=n;++i) if(link[s][i]) vis[i]=1;\n\t\tfor(int i=1;i<=n;++i) if(!vis[i]&&!dfn[i]){\n\t\t\tDfs(i);\n\t\t}\n\t\tTP::pre();TP::nm=nm;\n\t\tfor(int i=1;i<=n;++i) if(!vis[i]) ++TP::qu[id[i]];\n\t\tfor(int i=1;i<=m;++i){\n\t\t\tif(!vis[ed[i].x]&&!vis[ed[i].y]&&id[ed[i].x]!=id[ed[i].y]) TP::addedge(id[ed[i].y],id[ed[i].x]);\n\t\t}\n\t\tTP::solve();\n\t\tfor(int i=0;i<v[s].size();++i){\n\t\t\tas[v[s][i].id]=TP::qu[id[v[s][i].y]];\n\t\t}\n\t}\n\tvoid solve(){\n\t\tfor(int i=1;i<=n;++i) nddsfsdf(i);\n\t}\n}\nint tot;\nint fir[N],nxt[M],to[M];\nvoid addedge(int x,int y) {nxt[++tot]=fir[x];fir[x]=tot;to[tot]=y;}\nint ff[N][17];\nint dep[N];\nint si[N];\nvoid Dfs(int x,int fa){\n\tdep[x]=dep[fa]+1;ff[x][0]=fa;\n\tfor(int i=1;i<17;++i) ff[x][i]=ff[ff[x][i-1]][i-1];\n\tsi[x]=1;\n\tfor(int e=fir[x];e;e=nxt[e]){\n\t\tint y=to[e];\n\t\tDfs(y,x);\n\t\tsi[x]+=si[y];\n\t}\n}\nint lca(int x,int y){\n\tif(dep[x]<dep[y]) swap(x,y);\n\tfor(int i=16;~i;--i){\n\t\tif(dep[ff[x][i]]>=dep[y]) x=ff[x][i];\n\t}\n\tif(x==y) return x;\n\tfor(int i=16;~i;--i){\n\t\tif(ff[x][i]!=ff[y][i]) x=ff[x][i],y=ff[y][i];\n\t}\n\treturn ff[x][0];\n}\nint a[N];\nvoid pt(int x) {printf(\"%d\\n\",x);}\nint main(){\n//\tfreopen(\"a.in\",\"r\",stdin);\n////\tfreopen(\"ex_dominator3.in\",\"r\",stdin);\n//\tfreopen(\"dominator.out\",\"w\",stdout);\n\tint q;re(n);re(m);re(q);\n\tfor(int i=1,x,y;i<=m;++i){\n\t\tre(x);re(y);S::addedge(x,y);ed[i]=E(x,y);\n\t}\n\tfor(int i=1;i<=n;++i) S::solve(i);\n\tfor(int i=1;i<=n;++i) a[i]=i;\n\tsort(a+1,a+n+1,cmp);\n\tfor(int i=1;i<=n;++i){\n\t\tint x=a[i];\n\t\tfor(int j=1;j<=n;++j){\n\t\t\tif(j!=x&&!link[x][j]&&!vis[j]){\n\t\t\t\taddedge(x,j);vis[j]=true;\n\t\t\t}\n\t\t}\n\t}\n\tDfs(1,0);//23\n\tfor(int tima=1,x,y,z;tima<=q;++tima){\n\t\tre(x);re(y);z=lca(x,y);\n\t\tif(z==y||z==ff[y][0]) continue;\n\t\tx=y;int lala=0;\n\t\twhile(ff[y][0]!=z) y=ff[y][0],++lala;\n\t\tv[y].push_back(node(x,tima));\n\t}\n\tS::solve();\n\tfor(int i=1;i<=q;++i) pt(as[i]);\n\treturn 0;\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:12:14: error: ‘int link [3033][3033]’ redeclared as different kind of entity\n 12 | int link[N][N];\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,\n from /usr/include/signal.h:328,\n from /usr/include/c++/11/csignal:42,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:43,\n from /tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:1:\n/usr/include/unistd.h:819:12: note: previous declaration ‘int link(const char*, const char*)’\n 819 | extern int link (const char *__from, const char *__to)\n | ^~~~\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp: In function ‘void S::solve(int)’:\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:69:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 69 | st[tp=1]=1;link[s][s]=link[s][1]=1;\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:69:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 69 | st[tp=1]=1;link[s][s]=link[s][1]=1;\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:69:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 69 | st[tp=1]=1;link[s][s]=link[s][1]=1;\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:69:48: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 69 | st[tp=1]=1;link[s][s]=link[s][1]=1;\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:69:49: error: assignment of read-only location ‘*(link + (((sizetype)s) + 1))’\n 69 | st[tp=1]=1;link[s][s]=link[s][1]=1;\n | ~~~~~~~~~~^~\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:74:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 74 | if(!link[s][y]){\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:74:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 74 | if(!link[s][y]){\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:75:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 75 | st[++tp]=y;link[s][y]=1;\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:75:61: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 75 | st[++tp]=y;link[s][y]=1;\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:75:62: error: assignment of read-only location ‘*(link + (((sizetype)s) + ((sizetype)y)))’\n 75 | st[++tp]=y;link[s][y]=1;\n | ~~~~~~~~~~^~\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:79:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 79 | for(int i=1;i<=n;++i) if(i!=s&&!link[s][i]) ++halo[s];\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:79:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 79 | for(int i=1;i<=n;++i) if(i!=s&&!link[s][i]) ++halo[s];\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp: In function ‘void S::nddsfsdf(int)’:\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:108:48: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 108 | for(int i=1;i<=n;++i) if(link[s][i]) vis[i]=1;\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:108:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 108 | for(int i=1;i<=n;++i) if(link[s][i]) vis[i]=1;\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp: In function ‘int main()’:\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:169:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 169 | if(j!=x&&!link[x][j]&&!vis[j]){\n | ^\n/tmp/tmpprjz7a9z/72ff04b3-a0aa-41a9-98c5-1becec9181d1.cpp:169:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 169 | if(j!=x&&!link[x][j]&&!vis[j]){\n | ^\n" | |
| ], | |
| "tcb_id": "支配" | |
| }, | |
| { | |
| "code_id": 1, | |
| "code": "#include<bits/stdc++.h>\nusing std::vector;\ntypedef vector<int> vi;\ntypedef long long ll;\n#define all(a) a.begin(),a.end()\n#define all1(a) a.begin()+1,a.end()\ntemplate<typename Tp=int>inline Tp read(){Tp x(0);int op(0);char ch=getchar();while(ch<'0'||ch>'9')op|=(ch==45),ch=getchar();while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();return op?-x:x;}\nvoid cmax(int& x,int y){x<y?x=y:1;}\nvoid cmin(int& x,int y){x>y?x=y:1;}\nusing std::string;\nusing ull = unsigned ll;\n\nint main(){\n\tfreopen(\"game.in\",\"r\",stdin);\n freopen(\"game.out\",\"w\",stdout);\n\tint n;string s,t;std::cin>>n>>s;\n\tstd::unordered_map<size_t,int> mp;\n\tvector<ull> hs;hs.push_back(0);\n\tll ans=0;mp[0]++;\n\tfor(auto v:s){\n\t\tull nh=0;\n\t\tif(t.back()!=v){\n\t\t\tnh=hs.back()*19260817+v;\n\t\t\ths.push_back(nh);\n\t\t\tt.push_back(v);\n\t\t}\n\t\telse{\n\t\t\ths.pop_back();\n\t\t\tnh=hs.back();\n\t\t\tt.pop_back();\n\t\t}\n\t\tans+=mp[nh];\n\t\tmp[nh]++;\n\t}\n\tstd::cout<<ans<<'\\n';\n\treturn 0;\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/ccmg8fvX.s: Assembler messages:\n/tmp/ccmg8fvX.s:2094: Error: symbol `_ZSt4moveIRmEONSt16remove_referenceIT_E4typeEOS2_' is already defined\n/tmp/ccmg8fvX.s:2957: Error: symbol `_ZSt7forwardImEOT_RNSt16remove_referenceIS0_E4typeE' is already defined\n" | |
| ], | |
| "tcb_id": "消消乐" | |
| }, | |
| { | |
| "code_id": 18, | |
| "code": "#include<bits/stdc++.h>\r\n#define clear(a) memset(a,0,sizeof(a))\r\n#define full(a) memset(a,0x3f,sizeof(a))\r\n#define fornext(x,i) for(int i=head[x]; i; i=nxt[i])\r\n#define mset(a,b) memset(a,b,sizeof(a))\r\n#define dbg cout<<\"c \"\r\n#define Rep(i,a,b) for(int i=(a); i<=(b); ++i)\r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef double db;\r\n\r\ntemplate<typename _T>\r\ninline void read(_T &dig) {\r\n\tint flg; char c;\r\n\tflg = dig = 0;\r\n\twhile (c = getchar(), !isdigit(c)) if (c == '-') flg = 1;\r\n\twhile (isdigit(c)) dig = dig * 10 + c - '0', c = getchar();\r\n\tif (flg) dig = -dig;\r\n}\r\n\r\ntemplate <typename _T, typename ...Args>\r\ninline void read(_T &x, Args &...args) {\r\n\tread(x); read(args...);\r\n}\r\n\r\nconst int N = 200005;\t// no more than 2*n-1 states\r\nint len[N], link[N], nxt[N][26], f[N];\r\nint n, tot, last, t[N];\r\nstring s;\r\n\r\nstruct ele {\r\n\tint id, len;\r\n} a[N];\r\n\r\nbool cmp(const ele& a, const ele& b) {\r\n\treturn a.len > b.len;\r\n}\r\n\r\nvoid sam_init() {\r\n\tlen[0] = 0, link[0] = -1;\r\n\ttot = 0, last = 0;\r\n}\r\n\r\nvoid sam_extend(char ch) {\r\n\tint cur = ++tot;\r\n\tlen[cur] = len[last] + 1, f[cur] = 1;\r\n\tint p = last, c = ch - 'a', q;\r\n\twhile (p != -1 && !nxt[p][c]) nxt[p][c] = cur, p = link[p];\r\n\tif (p == -1) link[cur] = 0;\r\n\telse {\r\n\t\tq = nxt[p][c];\r\n\t\tif (len[q] == len[p] + 1) link[cur] = q;\r\n\t\telse {\r\n\t\t\t++tot;\r\n\t\t\tlen[tot] = len[p] + 1;\t\t\t//memcpy(nxt[tot],nxt[q],sizeof(nxt[q])*4);\r\n\t\t\tmemcpy(nxt[tot], nxt[q], sizeof(nxt[q]));\r\n\t\t\tlink[tot] = link[q];\r\n\t\t\tlink[q] = link[cur] = tot;\r\n\t\t\twhile (p != -1 && nxt[p][c] == q) nxt[p][c] = tot, p = link[p];\r\n\t\t}\r\n\t}\r\n\tlast = cur;\r\n}\r\n\r\nint main() {\r\n\tint T, k;\r\n\tread(T);\r\n\twhile (T--) {\r\n\t\tclear(nxt), clear(f), clear(link), clear(len), clear(t);\r\n\t\tcin >> s >> k;\r\n\t\tn = s.size(), s = '#' + s;\r\n\t\tsam_init();\r\n\t\tRep(i, 1, n) sam_extend(s[i]);\r\n\t\tRep(i, 1, tot) a[i] = (ele) {i, len[i]};\r\n\t\tsort(a, a + tot + 1, cmp);\r\n\t\tRep(i, 0, tot) f[link[a[i].id]] += f[a[i].id];\r\n\t\tRep(i, 1, tot) {\r\n\t\t\tif (f[i] == k) \r\n//\t\t\t\tcout<<len[link[i]] + 1<<' '<<len[i]<<endl,\r\n\t\t\t\t++t[len[link[i]] + 1], --t[len[i] + 1];\r\n\t\t}\r\n\t\tRep(i, 1, n) t[i] += t[i - 1];\r\n//\t\tRep(i,1,n) cout<<t[i]<<' ';\r\n\t\tint mx = 1, rec = -1;\r\n\t\tRep(i, 1, n) if (t[i] >= mx) mx = t[i], rec = i;\t// the max number of same-len-substings that exist exactly k times, and the length\r\n\t\tcout << rec << endl;\r\n\t}\r\n\treturn 0;\r\n}\r\n", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:27:19: error: ‘int link [200005]’ redeclared as different kind of entity\n 27 | int len[N], link[N], nxt[N][26], f[N];\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,\n from /usr/include/signal.h:328,\n from /usr/include/c++/11/csignal:42,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:43,\n from /tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:1:\n/usr/include/unistd.h:819:12: note: previous declaration ‘int link(const char*, const char*)’\n 819 | extern int link (const char *__from, const char *__to)\n | ^~~~\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp: In function ‘void sam_init()’:\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:40:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 40 | len[0] = 0, link[0] = -1;\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:40:29: error: assignment of read-only location ‘* link’\n 40 | len[0] = 0, link[0] = -1;\n | ~~~~~~~~^~~~\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp: In function ‘void sam_extend(char)’:\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:48:66: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 48 | while (p != -1 && !nxt[p][c]) nxt[p][c] = cur, p = link[p];\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:48:66: error: invalid conversion from ‘int (*)(const char*, const char*) noexcept’ {aka ‘int (*)(const char*, const char*)’} to ‘int’ [-fpermissive]\n 48 | while (p != -1 && !nxt[p][c]) nxt[p][c] = cur, p = link[p];\n | ~~~~~~^\n | |\n | int (*)(const char*, const char*) noexcept {aka int (*)(const char*, const char*)}\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:49:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 49 | if (p == -1) link[cur] = 0;\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:49:32: error: assignment of read-only location ‘*(link + ((sizetype)cur))’\n 49 | if (p == -1) link[cur] = 0;\n | ~~~~~~~~~~^~~\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:52:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 52 | if (len[q] == len[p] + 1) link[cur] = q;\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:52:53: error: assignment of read-only location ‘*(link + ((sizetype)cur))’\n 52 | if (len[q] == len[p] + 1) link[cur] = q;\n | ~~~~~~~~~~^~~\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:57:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 57 | link[tot] = link[q];\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:57:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 57 | link[tot] = link[q];\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:57:35: error: assignment of read-only location ‘*(link + ((sizetype)tot))’\n 57 | link[tot] = link[q];\n | ~~~~~~~~~~^~~~~~~~~\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:58:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 58 | link[q] = link[cur] = tot;\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:58:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 58 | link[q] = link[cur] = tot;\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:58:45: error: assignment of read-only location ‘*(link + ((sizetype)cur))’\n 58 | link[q] = link[cur] = tot;\n | ~~~~~~~~~~^~~~~\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:59:86: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 59 | while (p != -1 && nxt[p][c] == q) nxt[p][c] = tot, p = link[p];\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:59:86: error: invalid conversion from ‘int (*)(const char*, const char*) noexcept’ {aka ‘int (*)(const char*, const char*)’} to ‘int’ [-fpermissive]\n 59 | while (p != -1 && nxt[p][c] == q) nxt[p][c] = tot, p = link[p];\n | ~~~~~~^\n | |\n | int (*)(const char*, const char*) noexcept {aka int (*)(const char*, const char*)}\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp: In function ‘int main()’:\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:69:45: error: ISO C++ forbids applying ‘sizeof’ to an expression of function type [-fpermissive]\n 69 | clear(nxt), clear(f), clear(link), clear(len), clear(t);\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:2:36: note: in definition of macro ‘clear’\n 2 | #define clear(a) memset(a,0,sizeof(a))\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:69:45: error: invalid conversion from ‘int (*)(const char*, const char*) noexcept’ {aka ‘int (*)(const char*, const char*)’} to ‘void*’ [-fpermissive]\n 69 | clear(nxt), clear(f), clear(link), clear(len), clear(t);\n | ^~~~\n | |\n | int (*)(const char*, const char*) noexcept {aka int (*)(const char*, const char*)}\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:2:25: note: in definition of macro ‘clear’\n 2 | #define clear(a) memset(a,0,sizeof(a))\n | ^\nIn file included from /usr/include/c++/11/cstring:42,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:48,\n from /tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:1:\n/usr/include/string.h:61:28: note: initializing argument 1 of ‘void* memset(void*, int, size_t)’\n 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));\n | ~~~~~~^~~\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:76:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 76 | Rep(i, 0, tot) f[link[a[i].id]] += f[a[i].id];\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:76:33: error: invalid types ‘int [200005][int(const char*, const char*) noexcept {aka int(const char*, const char*)}]’ for array subscript\n 76 | Rep(i, 0, tot) f[link[a[i].id]] += f[a[i].id];\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:80:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 80 | ++t[len[link[i]] + 1], --t[len[i] + 1];\n | ^\n/tmp/tmpk4lxh9ni/24856825-63c7-4a9e-8569-7688ef008f10.cpp:80:40: error: invalid types ‘int [200005][int(const char*, const char*) noexcept {aka int(const char*, const char*)}]’ for array subscript\n 80 | ++t[len[link[i]] + 1], --t[len[i] + 1];\n | ^\n" | |
| ], | |
| "tcb_id": "甲苯先生和大中锋的字符串" | |
| }, | |
| { | |
| "code_id": 2, | |
| "code": "#include<bits/stdc++.h>\nusing namespace std;\nstruct edge\n{\n\tint u,v,w;\n}e[10005];\nvector<int>g[505];\nint mxd[2][505][505];\nint used[10005];\nint link[505][505];\nint pa[505];\nint n,m;\ntemplate<typename T>inline void r(T &I)\n{\n\tT w=1;I=0;char ch=getchar();\n\twhile(!isdigit(ch)&&ch!=EOF){if(ch=='-')w=-w;ch=getchar();}\n\twhile(isdigit(ch)&&ch!=EOF){I=(I<<3)+(I<<1)+(ch&15);ch=getchar();}\n\tI*=w;\n}\nint find(int x)\n{\n\treturn pa[x]=(x==pa[x]?x:find(pa[x]));\n}\nbool judge(int x,int y)\n{\n\treturn find(x)==find(y);\n}\nvoid merge(int x,int y)\n{\n\tint zx=find(x),zy=find(y);\n\tif(!judge(x,y))\n\t{\n\t\tpa[zx]=zy;\n\t\tfor(int i=0;i<g[zx].size();i++)\n\t\t{\n\t\t\tg[zy].push_back(g[zx][i]);\n\t\t}\n\t}\n}\nbool nmp(edge x,edge y)\n{\n\treturn x.w<y.w;\n}\nint main()\n{\n\tr(n);r(m);\n\tfor(int i=1,x=0,y=0,z=0;i<=m;i++)\n\t{\n\t\tr(x);r(y);r(z);\n\t\te[i]=(edge){x,y,z};\n\t}\n\tsort(e+1,e+m+1,nmp);\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tg[i].push_back(i);\n\t\tpa[i]=i;\n\t}\n\tint tot=0;\n\tlong long ans=0;\n\tfor(int i=1;i<=m;i++)\n\t{\n\t\tif(tot==n-1) break;\n\t\tif(!judge(e[i].u,e[i].v))\n\t\t{\n\t\t\tans+=e[i].w;\n\t\t\tused[i]=1;\n\t\t\tlink[e[i].u][e[i].v]=e[i].w;\n\t\t\tfor(int j=0;j<g[find(e[i].u)].size();j++)\n\t\t\t{\n\t\t\t\tfor(int k=0;k<g[find(e[i].v)].size();k++)\n\t\t\t\t{\n\t\t\t\t\tmxd[1][g[find(e[i].u)][j]][g[find(e[i].v)][k]]=mxd[0][g[find(e[i].u)][j]][g[find(e[i].v)][k]];\n\t\t\t\t\tmxd[0][g[find(e[i].u)][j]][g[find(e[i].v)][k]]=e[i].w;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmerge(e[i].u,e[i].v);\n\t\t}\n\t}\n\tlong long emm=ans;//cout<<ans<<\"\\n\";\n\tans=0x3f3f3f3f3f3f3f3f;\n\tfor(int i=1;i<=m;i++)\n\t{\n\t\tif(used[i]) continue;\n\t\t/*if(link[e[i].u][e[i].v])\n\t\t{\n\t\t\tans=min(ans,emm+e[i].w-link[e[i].u][e[i].v]);\n\t\t\t//cout<<ans<<\"???\\n\";\n\t\t}*/\n\t\telse if(e[i].w>mxd[0][e[i].u][e[i].v])\n\t\t{\n\t\t\tans=min(ans,emm+e[i].w-mxd[0][e[i].u][e[i].v]);\n\t\t\t//cout<<e[i].u<<\" \"<<e[i].v<<\" \"<<mxd[e[i].u][e[i].v]<<\"\\n\";\n\t\t\t//cout<<ans<<\"!!!\\n\";\n\t\t}\n\t\telse if(e[i].w>mxd[1][e[i].u][e[i].v])\n\t\t{\n\t\t\tans=min(ans,emm+e[i].w-mxd[1][e[i].u][e[i].v]);\n\t\t}\n\t}\n\tcout<<ans<<\"\\n\";\n\treturn 0;\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpnc30ck2e/b4c5b1d3-fe3d-4e88-8ccd-a2aa927714bf.cpp:10:18: error: ‘int link [505][505]’ redeclared as different kind of entity\n 10 | int link[505][505];\n | ^\nIn file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,\n from /usr/include/signal.h:328,\n from /usr/include/c++/11/csignal:42,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:43,\n from /tmp/tmpnc30ck2e/b4c5b1d3-fe3d-4e88-8ccd-a2aa927714bf.cpp:1:\n/usr/include/unistd.h:819:12: note: previous declaration ‘int link(const char*, const char*)’\n 819 | extern int link (const char *__from, const char *__to)\n | ^~~~\n/tmp/tmpnc30ck2e/b4c5b1d3-fe3d-4e88-8ccd-a2aa927714bf.cpp: In function ‘int main()’:\n/tmp/tmpnc30ck2e/b4c5b1d3-fe3d-4e88-8ccd-a2aa927714bf.cpp:67:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 67 | link[e[i].u][e[i].v]=e[i].w;\n | ^\n/tmp/tmpnc30ck2e/b4c5b1d3-fe3d-4e88-8ccd-a2aa927714bf.cpp:67:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]\n 67 | link[e[i].u][e[i].v]=e[i].w;\n | ^\n/tmp/tmpnc30ck2e/b4c5b1d3-fe3d-4e88-8ccd-a2aa927714bf.cpp:67:45: error: assignment of read-only location ‘*(link + (((sizetype)e[i].edge::u) + ((sizetype)e[i].edge::v)))’\n 67 | link[e[i].u][e[i].v]=e[i].w;\n | ~~~~~~~~~~~~~~~~~~~~^~~~~~~\n" | |
| ], | |
| "tcb_id": "秘密的牛奶运输" | |
| }, | |
| { | |
| "code_id": 4, | |
| "code": "#include<cstdio>\r\n#include<cstdlib>\r\n#include<algorithm>\r\n#include<cstring>\r\n#include<unordered_map>\r\n#define maxn 200005\r\n#define ll unsigned long long\r\nusing namespace std;\r\nconst ll p=1234321237;\r\nint st[maxn],top;\r\nint par[maxn];\r\nll Pow[maxn],Hash[maxn];\r\nint in[maxn],out[maxn];\r\nvector<int> G[maxn],kt[maxn];\r\nint have[maxn];\r\nunordered_map<ll,int> table;\r\nint n,k;\r\nvoid Pre_Dfs(int x)\r\n{\r\n\tpar[++par[0]]=1;\r\n\tin[x]=par[0];\r\n\tfor(int i=0;i<G[x].size();i++) Pre_Dfs(G[x][i]);\r\n\tpar[++par[0]]=2;\r\n\tout[x]=par[0];\r\n}\r\nvoid dfs(int x)\r\n{\r\n\tst[++top]=x;\r\n\tif(top>k+1) kt[st[top-k-1]].push_back(x);\r\n\tif(top>k) have[st[top-k]]=1;\r\n\tfor(int i=0;i<G[x].size();i++) dfs(G[x][i]);\r\n\tst[top--]=0;\r\n}\r\nint main()\r\n{\r\n\tscanf(\"%d\",&n);\r\n\tfor(int i=1;i<=n;i++)\r\n\t{\r\n\t\tint sz;\r\n\t\tscanf(\"%d\",&sz);\r\n\t\tfor(int j=1;j<=sz;j++)\r\n\t\t{\r\n\t\t\tint son;\r\n\t\t\tscanf(\"%d\",&son);\r\n\t\t\tG[i].push_back(son);\r\n\t\t}\r\n\t}\r\n\tPre_Dfs(1);\r\n\tPow[1]=1;\r\n\tfor(int i=2;i<=par[0];i++) Pow[i]=Pow[i-1]*p;\r\n\tfor(int i=1;i<=par[0];i++) Hash[i]=Hash[i-1]+Pow[i]*par[i];\r\n\tint l=1,r=n,ans=0;\r\n\twhile(l<=r)\r\n\t{\r\n\t\tk=(l+r)>>1;\r\n\t\ttable.clear();\r\n\t\tmemset(have,0,sizeof(have));\r\n\t\tfor(int i=1;i<=n;i++) kt[i].clear();\r\n\t\tdfs(1);\t\r\n\t\tint flag=0;\r\n\t\tfor(int i=1;i<=n;i++)\r\n\t\t{\r\n\t\t\tif(!have[i]) continue;\r\n\t\t\tint en=out[i],tlen=0;\r\n\t\t\tll Ha=0;\r\n\t\t\tfor(int j=kt[i].size()-1;j>=0;j--)\r\n\t\t\t{\r\n\t\t\t\tHa+=(Hash[en]-Hash[out[kt[i][j]]])*Pow[par[0]-en-tlen+1];\r\n\t\t\t\ttlen+=en-out[kt[i][j]];\r\n\t\t\t\ten=in[kt[i][j]]-1;\r\n\t\t\t}\r\n\t\t\tHa+=(Hash[en]-Hash[in[i]-1])*Pow[par[0]-en-tlen+1];\r\n\t\t\t//printf(\"%u\\n\",Ha);\r\n\t\t\tif(table[Ha]==1){flag=1;break;}\r\n\t\t\telse table[Ha]=1;\r\n\t\t}\r\n\t\tif(flag) ans=l,l=k+1;\r\n\t\telse r=k-1;\r\n\t}\r\n\tprintf(\"%d\",ans);\r\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp:14:1: error: ‘vector’ does not name a type\n 14 | vector<int> G[maxn],kt[maxn];\n | ^~~~~~\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp: In function ‘void Pre_Dfs(int)’:\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp:22:23: error: ‘G’ was not declared in this scope\n 22 | for(int i=0;i<G[x].size();i++) Pre_Dfs(G[x][i]);\n | ^\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp: In function ‘void dfs(int)’:\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp:29:21: error: ‘kt’ was not declared in this scope; did you mean ‘st’?\n 29 | if(top>k+1) kt[st[top-k-1]].push_back(x);\n | ^~\n | st\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp:31:23: error: ‘G’ was not declared in this scope\n 31 | for(int i=0;i<G[x].size();i++) dfs(G[x][i]);\n | ^\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp: In function ‘int main()’:\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp:45:25: error: ‘G’ was not declared in this scope\n 45 | G[i].push_back(son);\n | ^\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp:58:39: error: ‘kt’ was not declared in this scope; did you mean ‘st’?\n 58 | for(int i=1;i<=n;i++) kt[i].clear();\n | ^~\n | st\n/tmp/tmpzj3brwkw/62ce7c9a-6aa1-4f59-bba2-a40b002d770c.cpp:66:35: error: ‘kt’ was not declared in this scope; did you mean ‘st’?\n 66 | for(int j=kt[i].size()-1;j>=0;j--)\n | ^~\n | st\n" | |
| ], | |
| "tcb_id": "第二题" | |
| }, | |
| { | |
| "code_id": 3, | |
| "code": "#ifndef _MENCI_AVL_TREE_H\r\n#define _MENCI_AVL_TREE_H\r\n\r\n#include <stdbool.h>\r\n#include <stddef.h>\r\n\r\ntypedef int (*compare_function_t)(void *, void *);\r\ntypedef void (*destruct_function_t)(void *);\r\ntypedef struct _avl_node_t *avl_node_t;\r\ntypedef struct _avl_tree_t *avl_tree_t;\r\n\r\navl_tree_t avl_create(compare_function_t compare_function, destruct_function_t destruct_function);\r\nvoid avl_destroy(avl_tree_t tree);\r\nsize_t avl_size(avl_tree_t tree);\r\navl_node_t avl_insert(avl_tree_t tree, void *data);\r\nvoid *avl_get_data(avl_node_t node);\r\navl_node_t avl_find(avl_tree_t tree, void *data);\r\navl_node_t avl_find_by_order(avl_tree_t tree, int order);\r\nint avl_get_order(avl_tree_t tree, void *data);\r\nint avl_get_order_of_node(avl_node_t node);\r\nvoid avl_delete_node(avl_node_t node);\r\nbool avl_delete_data(avl_tree_t tree, void *data);\r\n\r\navl_node_t avl_lower_bound(avl_tree_t tree, void *data);\r\navl_node_t avl_upper_bound(avl_tree_t tree, void *data);\r\navl_node_t avl_node_predecessor(avl_node_t node);\r\navl_node_t avl_node_successor(avl_node_t node);\r\n\r\n#endif // _MENCI_AVL_TREE_H\r\n#ifndef _MENCI_AVL_TREE_INTERNEL_H\r\n#define _MENCI_AVL_TREE_INTERNEL_H\r\n\r\n// #include \"avl-tree.h\"\r\n\r\nstruct _avl_node_t {\r\n struct _avl_node_t *left_child;\r\n struct _avl_node_t *right_child;\r\n struct _avl_node_t *parent;\r\n\r\n // The data field.\r\n void *data;\r\n\r\n // The height of the subtree with this node as its root.\r\n int height;\r\n\r\n // The count of nodes in this subtree.\r\n size_t size;\r\n\r\n // The reference to its tree, to replace the root node when rotated to root.\r\n struct _avl_tree_t *tree;\r\n};\r\n\r\nstruct _avl_tree_t {\r\n // The root node of the tree.\r\n avl_node_t root;\r\n\r\n // The compare function, to determine the order of nodes' data.\r\n compare_function_t compare_function;\r\n\r\n // The destruct function, to destruct and free nodes' data.\r\n destruct_function_t destruct_function;\r\n};\r\n\r\ntypedef enum {\r\n LEFT = 0, RIGHT = 1\r\n} _avl_which_child_t;\r\n\r\n// Validate and print a subtree, for debugging.\r\nvoid _avl_debug(avl_node_t node, bool print, int depth);\r\n\r\n// Compare two data or node's data, compare by unsigned long if\r\n// compare_function is NULL or call the compare_function if non-NULL.\r\nint _avl_compare_data(compare_function_t compare_function, void *a, void *b);\r\nint _avl_compare_node(avl_node_t a, avl_node_t b);\r\n\r\n// Destroy a node or a subtree.\r\nvoid _avl_destroy_node(avl_node_t node);\r\nvoid _avl_destroy_subtree(avl_node_t node);\r\n\r\n// Recalculate a node's height and size after rotating, rebalancing, insertion\r\n// or deletion.\r\nvoid _avl_recalculate(avl_node_t node);\r\n\r\n// Rotate a node up, to take its parent's place.\r\n// e.g. Left rotate will let one's right-child take its place of subtree root.\r\nvoid _avl_rotate(avl_node_t node);\r\n\r\n// Do a rebalance on a subtree's root level, used when abs(balance factor) = 2.\r\nvoid _avl_rebalance(avl_node_t subtree_root, avl_node_t new_node);\r\n\r\n// Insert a node to a node's subtree.\r\nvoid _avl_insert_node(avl_node_t *subtree_root,\r\n avl_node_t parent,\r\n avl_node_t new_node);\r\n\r\ntypedef enum {\r\n // Doing a lower_bound binary search means skip all nodes less than specfied data.\r\n // So skip all nodes that compare(node->data, data) <= -1.\r\n // For the same reason, doing a upper_bound binary search skips all nodes that\r\n // compare() <= 0.\r\n // So skip nodes that compare() <= search_type will do the magic.\r\n LOWER_BOUND = -1,\r\n UPPER_BOUND = 0\r\n} _avl_search_type_t;\r\n\r\n// Binary Search a data, return found node according to search_type.\r\navl_node_t _avl_binary_search(avl_node_t root,\r\n void *data,\r\n _avl_search_type_t search_type);\r\n\r\n// Get a node's in-order predecessor or successor.\r\n// direction = LEFT means predecessor, RIGHT means successor.\r\navl_node_t _avl_neighbour(avl_node_t node, _avl_which_child_t direction);\r\n\r\n// Swap two node's position.\r\nvoid _avl_swap(avl_node_t a, avl_node_t b);\r\n\r\n// Delete a node, while maintaining the balance.\r\nvoid _avl_delete_rebalance(avl_node_t node);\r\nvoid _avl_delete(avl_node_t node);\r\n\r\nint _avl_get_order(avl_node_t node);\r\n\r\n#endif // _MENCI_AVL_TREE_INTERNEL_H\r\n// #include \"avl-tree-internel.h\"\r\n\r\n#include <assert.h>\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n\r\n#define _avl_which_child(node) \\\r\n ((node) == (node)->parent->left_child ? LEFT : RIGHT)\r\n#define _avl_get_child(node, which) \\\r\n (*((which) == LEFT ? (&(node)->left_child) : (&(node)->right_child)))\r\n#define _avl_subtree_height(node) ((node) ? ((node)->height) : 0)\r\n\r\nvoid _avl_debug(avl_node_t node, bool print, int depth) {\r\n if (!node) return;\r\n\r\n if (print && !depth) puts(\"-------------------\");\r\n\r\n int right_height = 0;\r\n size_t right_size = 0;\r\n if (node->right_child) {\r\n assert(node->right_child->parent == node);\r\n _avl_debug(node->right_child, print, depth + 1);\r\n right_height = node->right_child->height;\r\n right_size = node->right_child->size;\r\n }\r\n\r\n if (print) {\r\n for (int i = 0; i < depth; i++) fputs(\" \", stdout);\r\n printf(\"%lu\\n\", (unsigned long)node->data);\r\n }\r\n\r\n int left_height = 0;\r\n size_t left_size = 0;\r\n if (node->left_child) {\r\n assert(node->left_child->parent == node);\r\n _avl_debug(node->left_child, print, depth + 1);\r\n left_height = node->left_child->height;\r\n left_size = node->left_child->size;\r\n }\r\n\r\n\r\n if (print && !depth) puts(\"-------------------\");\r\n\r\n int max = left_height < right_height ? right_height : left_height;\r\n assert(node->height == max + 1);\r\n assert(node->size == left_size + right_size + 1);\r\n assert(abs(left_height - right_height) < 2);\r\n}\r\n\r\nint _avl_compare_data(compare_function_t compare_function, void *a, void *b) {\r\n if (a == b) return 0;\r\n if (compare_function) {\r\n return compare_function(a, b);\r\n }\r\n\r\n return (unsigned long)a < (unsigned long)b ? -1 : 1;\r\n}\r\n\r\nint _avl_compare_node(avl_node_t a, avl_node_t b) {\r\n assert(a && b && a->tree == b->tree);\r\n if (a == b) return 0;\r\n return _avl_compare_data(a->tree->compare_function, a->data, b->data);\r\n}\r\n\r\nvoid _avl_destroy_node(avl_node_t node) {\r\n if (node->tree->destruct_function) {\r\n node->tree->destruct_function(node->data);\r\n }\r\n\r\n free(node);\r\n}\r\n\r\nvoid _avl_destroy_subtree(avl_node_t node) {\r\n if (node->left_child) _avl_destroy_subtree(node->left_child);\r\n if (node->right_child) _avl_destroy_subtree(node->right_child);\r\n _avl_destroy_node(node);\r\n}\r\n\r\nvoid _avl_recalculate(avl_node_t node) {\r\n assert(node);\r\n\r\n int max_height = 0;\r\n node->size = 1;\r\n\r\n if (node->left_child) {\r\n if (node->left_child->height > max_height)\r\n max_height = node->left_child->height;\r\n node->size += node->left_child->size;\r\n }\r\n if (node->right_child) {\r\n if (node->right_child->height > max_height)\r\n max_height = node->right_child->height;\r\n node->size += node->right_child->size;\r\n }\r\n \r\n node->height = max_height + 1;\r\n}\r\n\r\nvoid _avl_rotate(avl_node_t node) {\r\n assert(node && node->parent);\r\n\r\n avl_node_t old_parent = node->parent;\r\n\r\n _avl_which_child_t which = _avl_which_child(node), another = !which;\r\n\r\n // Connect self to old parent's parent.\r\n node->parent = old_parent->parent;\r\n if (old_parent->parent)\r\n _avl_get_child(old_parent->parent, _avl_which_child(old_parent)) = node;\r\n \r\n // Connect self's another child to old parent\r\n if (_avl_get_child(node, another)) {\r\n _avl_get_child(node, another)->parent = old_parent;\r\n }\r\n _avl_get_child(old_parent, which) = _avl_get_child(node, another);\r\n\r\n // Connect old parent to self\r\n old_parent->parent = node;\r\n _avl_get_child(node, another) = old_parent;\r\n\r\n // Notice that the ancestors of old_parent's height are NOT recalculated.\r\n _avl_recalculate(old_parent);\r\n _avl_recalculate(node);\r\n\r\n // Check if rotated to root.\r\n if (!node->parent) {\r\n node->tree->root = node;\r\n }\r\n}\r\n\r\nvoid _avl_insert_node(avl_node_t *subtree_root,\r\n avl_node_t parent,\r\n avl_node_t new_node) {\r\n if (!*subtree_root) {\r\n new_node->parent = parent;\r\n *subtree_root = new_node;\r\n return;\r\n }\r\n\r\n avl_node_t current = *subtree_root;\r\n\r\n if (_avl_compare_node(new_node, current) <= 0) {\r\n // new data <= current node's data\r\n _avl_insert_node(¤t->left_child, current, new_node);\r\n\r\n // Check balance.\r\n if (_avl_subtree_height(current->left_child) - \r\n _avl_subtree_height(current->right_child) == 2) {\r\n // The balance has been broken, rebalance it.\r\n // Check which child of left-child it's inserted to.\r\n if (_avl_compare_node(new_node, current->left_child) <= 0) {\r\n // The Left-Left case.\r\n _avl_rotate(current->left_child);\r\n } else {\r\n // The Left-Right case.\r\n _avl_rotate(current->left_child->right_child);\r\n _avl_rotate(current->left_child);\r\n }\r\n }\r\n } else {\r\n // new data > current node's data\r\n _avl_insert_node(¤t->right_child, current, new_node);\r\n\r\n // Check balance.\r\n if (_avl_subtree_height(current->right_child) - \r\n _avl_subtree_height(current->left_child) == 2) {\r\n // The balance has been broken, rebalance it.\r\n // Check which child of right-child it's inserted to.\r\n if (_avl_compare_node(new_node, current->right_child) <= 0) {\r\n // The Right-Left case.\r\n _avl_rotate(current->right_child->left_child);\r\n _avl_rotate(current->right_child);\r\n } else {\r\n // The Right-Right case.\r\n _avl_rotate(current->right_child);\r\n }\r\n }\r\n }\r\n\r\n _avl_recalculate(*subtree_root);\r\n}\r\n\r\navl_node_t _avl_binary_search(avl_node_t root,\r\n void *data,\r\n _avl_search_type_t search_type) {\r\n if (!root) return NULL;\r\n\r\n int compare_result = _avl_compare_data(root->tree->compare_function,\r\n root->data,\r\n data);\r\n\r\n // Since we should find the first satisfied node, search in the left\r\n // subtree if satisfied.\r\n bool satisfied = compare_result > search_type;\r\n if (satisfied) {\r\n avl_node_t left_subtree_result = _avl_binary_search(root->left_child,\r\n data,\r\n search_type);\r\n // If a more left satisfied node was found, return it.\r\n if (left_subtree_result) return left_subtree_result;\r\n else return root;\r\n } else {\r\n return _avl_binary_search(root->right_child,\r\n data,\r\n search_type);\r\n }\r\n}\r\n\r\navl_node_t _avl_neighbour(avl_node_t node, _avl_which_child_t direction) {\r\n assert(node);\r\n\r\n // Imagine a traversal on the tree. We are on the node now and willing to\r\n // move to the in-order (or reversed in-order) next node.\r\n // e.g. find one's successor, with direction = RIGHT.\r\n if (_avl_get_child(node, direction)) {\r\n // If RIGHT subtree, find in the subtree.\r\n // Find the LEFT-most descendant of node's RIGHT subtree.\r\n node = _avl_get_child(node, direction);\r\n while (_avl_get_child(node, !direction)) {\r\n node = _avl_get_child(node, !direction);\r\n }\r\n return node;\r\n } else {\r\n // The RIGHT subtree doesn't exist, backtraces will occur.\r\n if (!node->parent) {\r\n // Backtrace reaches root. No successor found!\r\n return NULL;\r\n }\r\n\r\n while (_avl_which_child(node) == direction) {\r\n // If node is its parent's RIGHT child, after backtracing to parent,\r\n // another backtrace will occur to parent's parent.\r\n if (!node->parent->parent) {\r\n // Backtrace reaches root. No successor found!\r\n return NULL;\r\n }\r\n\r\n node = node->parent;\r\n }\r\n\r\n // If node is its parent's LEFT child, the next to be printed in the\r\n // traversal is just its parent!\r\n return node->parent;\r\n }\r\n}\r\n\r\nvoid _avl_swap(avl_node_t a, avl_node_t b) {\r\n assert(a && b);\r\n\r\n#define _avl_reconnect(parent_node, child, which) { \\\r\n if (parent_node) { \\\r\n _avl_get_child((parent_node), (which)) = (child); \\\r\n } else { \\\r\n assert(child); \\\r\n (child)->tree->root = (child); \\\r\n } \\\r\n if (child) (child)->parent = (parent_node); \\\r\n }\r\n\r\n // If one is another's parent, assume a is b's parent.\r\n if (a->parent == b) {\r\n _avl_swap(b, a);\r\n }\r\n\r\n _avl_which_child_t which_a = a->parent ? _avl_which_child(a) : LEFT,\r\n which_b = b->parent ? _avl_which_child(b) : LEFT;\r\n\r\n if (a == b->parent) {\r\n // If a is b's parent.\r\n avl_node_t c1 = _avl_get_child(b, which_b),\r\n c2 = _avl_get_child(b, !which_b),\r\n c3 = _avl_get_child(a, !which_b);\r\n \r\n _avl_reconnect(a->parent, b, which_a);\r\n\r\n _avl_reconnect(a, c1, which_b);\r\n _avl_reconnect(a, c2, !which_b);\r\n\r\n _avl_reconnect(b, a, which_b);\r\n _avl_reconnect(b, c3, !which_b);\r\n } else {\r\n avl_node_t a_l = a->left_child, a_r = a->right_child,\r\n b_l = b->left_child, b_r = b->right_child;\r\n\r\n avl_node_t a_p = a->parent, b_p = b->parent;\r\n _avl_reconnect(a_p, b, which_a);\r\n _avl_reconnect(b_p, a, which_b);\r\n\r\n _avl_reconnect(a, b_l, LEFT);\r\n _avl_reconnect(a, b_r, RIGHT);\r\n\r\n _avl_reconnect(b, a_l, LEFT);\r\n _avl_reconnect(b, a_r, RIGHT);\r\n }\r\n\r\n#undef _avl_reconnect\r\n}\r\n\r\nvoid _avl_delete_rebalance(avl_node_t node) {\r\n if (!node) return;\r\n\r\n if (_avl_subtree_height(node->left_child) - \r\n _avl_subtree_height(node->right_child) == 2) {\r\n // L - R = 2\r\n\r\n if (_avl_subtree_height(node->left_child->left_child) >=\r\n _avl_subtree_height(node->left_child->right_child)) {\r\n // The Left-Left case.\r\n _avl_rotate(node->left_child);\r\n } else {\r\n // The Left-Right case.\r\n _avl_rotate(node->left_child->right_child);\r\n _avl_rotate(node->left_child);\r\n }\r\n } else if (_avl_subtree_height(node->right_child) - \r\n _avl_subtree_height(node->left_child) == 2) {\r\n // R - L = 2\r\n\r\n if (_avl_subtree_height(node->right_child->left_child) <=\r\n _avl_subtree_height(node->right_child->right_child)) {\r\n // The Right-Right case.\r\n _avl_rotate(node->right_child);\r\n } else {\r\n // The Right-Left case.\r\n _avl_rotate(node->right_child->left_child);\r\n _avl_rotate(node->right_child);\r\n }\r\n }\r\n\r\n _avl_recalculate(node);\r\n _avl_delete_rebalance(node->parent);\r\n}\r\n\r\nvoid _avl_delete(avl_node_t node) {\r\n assert(node);\r\n\r\n while (node->left_child || node->right_child) {\r\n // Both children exist.\r\n // In this case its in-order predecessor or successor must be its descendant.\r\n // Find it's in-order predecessor or successor to take its place.\r\n avl_node_t neighbour = _avl_neighbour(node, node->left_child ? LEFT : RIGHT);\r\n\r\n // Swap the node and its neighbour.\r\n _avl_swap(node, neighbour);\r\n }\r\n\r\n // Now the node has no child, delete it.\r\n if (!node->parent) {\r\n node->tree->root = NULL;\r\n } else {\r\n _avl_get_child(node->parent, _avl_which_child(node)) = NULL;\r\n }\r\n\r\n // Since deleting a node breaks the balance, rebalance it.\r\n _avl_delete_rebalance(node->parent);\r\n\r\n _avl_destroy_node(node);\r\n}\r\n\r\nint _avl_get_order(avl_node_t node) {\r\n assert(node);\r\n \r\n int count = node->left_child ? node->left_child->size : 0;\r\n while (node->parent) {\r\n if (_avl_which_child(node) == RIGHT) {\r\n // If node is a RIGHT child, the parent and parent's LEFT subtree\r\n // is lesser than node, so add them to the count.\r\n if (node->parent->left_child) {\r\n count += node->parent->left_child->size;\r\n }\r\n count++;\r\n }\r\n\r\n node = node->parent;\r\n }\r\n\r\n return count + 1;\r\n}\r\n// #include \"avl-tree.h\"\r\n\r\n#include <stdlib.h>\r\n#include <assert.h>\r\n\r\n// #include \"avl-tree-internel.h\"\r\n\r\navl_tree_t avl_create(compare_function_t compare_function, destruct_function_t destruct_function) {\r\n avl_tree_t tree = malloc(sizeof(struct _avl_tree_t));\r\n tree->root = NULL;\r\n tree->compare_function = compare_function;\r\n tree->destruct_function = destruct_function;\r\n return tree;\r\n}\r\n\r\nvoid avl_destroy(avl_tree_t tree) {\r\n assert(tree);\r\n \r\n if (tree->root) _avl_destroy_subtree(tree->root);\r\n free(tree);\r\n}\r\n\r\nsize_t avl_size(avl_tree_t tree) {\r\n assert(tree);\r\n return tree->root ? tree->root->size : 0;\r\n}\r\n\r\navl_node_t avl_insert(avl_tree_t tree, void *data) {\r\n assert(tree);\r\n\r\n avl_node_t new_node = malloc(sizeof(struct _avl_node_t));\r\n new_node->left_child = new_node->right_child = new_node->parent = NULL;\r\n new_node->data = data;\r\n new_node->height = 1;\r\n new_node->size = 1;\r\n new_node->tree = tree;\r\n \r\n _avl_insert_node(&tree->root, NULL, new_node);\r\n\r\n return new_node;\r\n}\r\n\r\nvoid *avl_get_data(avl_node_t node) {\r\n return node->data;\r\n}\r\n\r\navl_node_t avl_find(avl_tree_t tree, void *data) {\r\n assert(tree);\r\n\r\n if (!tree->root) return NULL;\r\n\r\n avl_node_t node = avl_lower_bound(tree, data);\r\n if (node && node->data == data) return node;\r\n\r\n return NULL;\r\n}\r\n\r\navl_node_t avl_find_by_order(avl_tree_t tree, int order) {\r\n assert(tree);\r\n \r\n avl_node_t node = tree->root;\r\n\r\n // How many nodes should be skipped from the leftist of node's subtree.\r\n int count = order - 1;\r\n while (1) {\r\n if (!node) {\r\n // Not found - order isn't in [1, tree->root->size].\r\n return NULL;\r\n }\r\n\r\n int left_count = node->left_child ? node->left_child->size : 0;\r\n if (count < left_count) {\r\n // Skip part of the left subtree, not the whole left subtree.\r\n // So the node to find must be in the left subtree.\r\n node = node->left_child;\r\n } else if (count > left_count) {\r\n // The whole left subtree should be skipped, and node itself should\r\n // be skipped, too.\r\n // So skip them and find the node in the right subtree.\r\n count -= left_count + 1;\r\n node = node->right_child;\r\n } else {\r\n // The node to skip is exactly the whole left subtree.\r\n // So current node is what we're finding.\r\n return node;\r\n }\r\n }\r\n}\r\n\r\nint avl_get_order(avl_tree_t tree, void *data) {\r\n assert(tree);\r\n\r\n avl_node_t node = avl_find(tree, data);\r\n if (!node) return -1;\r\n return avl_get_order_of_node(node);\r\n}\r\n\r\nint avl_get_order_of_node(avl_node_t node) {\r\n assert(node);\r\n\r\n return _avl_get_order(node);\r\n}\r\n\r\nvoid avl_delete_node(avl_node_t node) {\r\n assert(node);\r\n\r\n _avl_delete(node);\r\n}\r\n\r\nbool avl_delete_data(avl_tree_t tree, void *data) {\r\n assert(tree);\r\n\r\n avl_node_t node = avl_find(tree, data);\r\n if (!node) return false;\r\n\r\n avl_delete_node(node);\r\n return true;\r\n}\r\n\r\navl_node_t avl_lower_bound(avl_tree_t tree, void *data) {\r\n assert(tree);\r\n return _avl_binary_search(tree->root, data, LOWER_BOUND);\r\n}\r\n\r\navl_node_t avl_upper_bound(avl_tree_t tree, void *data) {\r\n assert(tree);\r\n return _avl_binary_search(tree->root, data, UPPER_BOUND);\r\n}\r\n\r\navl_node_t avl_node_predecessor(avl_node_t node) {\r\n assert(node);\r\n return _avl_neighbour(node, LEFT);\r\n}\r\n\r\navl_node_t avl_node_successor(avl_node_t node) {\r\n assert(node);\r\n return _avl_neighbour(node, RIGHT);\r\n}\r\n// #include \"avl-tree.h\"\r\n\r\n#include <stdio.h>\r\n#include <assert.h>\r\n\r\n#define data_type_from_int(x) ((void *)(long)(x))\r\n#define data_type_to_int(x) ((int)(long)(x))\r\n\r\nint compare(void *a, void *b) {\r\n return data_type_to_int(a) - data_type_to_int(b);\r\n}\r\n\r\nint main() {\r\n avl_tree_t tree = avl_create(&compare, NULL);\r\n\r\n int n;\r\n assert(scanf(\"%d\", &n) == 1);\r\n assert(n >= 1 && n <= (int)3e5);\r\n\r\n for (int i = 0; i < n; i++) {\r\n int option, x;\r\n assert(scanf(\"%d %d\", &option, &x) == 2);\r\n assert(option >= 0 && option <= 5);\r\n\r\n if (option == 0) {\r\n avl_insert(tree, data_type_from_int(x));\r\n } else if (option == 1) {\r\n avl_delete_data(tree, data_type_from_int(x));\r\n } else if (option == 2) {\r\n avl_node_t node = avl_find_by_order(tree, x);\r\n assert(node);\r\n printf(\"%d\\n\", data_type_to_int(avl_get_data(node)));\r\n } else if (option == 3) {\r\n avl_node_t node = avl_lower_bound(tree, data_type_from_int(x));\r\n int answer;\r\n if (node) {\r\n answer = avl_get_order_of_node(node) - 1;\r\n } else {\r\n answer = avl_size(tree);\r\n }\r\n printf(\"%d\\n\", answer);\r\n } else if (option == 4) {\r\n avl_node_t node = avl_lower_bound(tree, data_type_from_int(x)),\r\n predecessor = node ? avl_node_predecessor(node) : NULL;\r\n if (predecessor) {\r\n printf(\"%d\\n\", data_type_to_int(avl_get_data(predecessor)));\r\n } else {\r\n puts(\"-1\");\r\n }\r\n } else if (option == 5) {\r\n avl_node_t successor = avl_upper_bound(tree, data_type_from_int(x));\r\n if (successor) {\r\n printf(\"%d\\n\", data_type_to_int(avl_get_data(successor)));\r\n } else {\r\n puts(\"-1\");\r\n }\r\n }\r\n }\r\n}\r\n", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "cc1plus: warning: command-line option ‘-std=c99’ is valid for C/ObjC but not for C++\n/tmp/tmplkmytsa6/c5a51fe6-b445-49ef-bd01-a596f3ddb9e8.cpp: In function ‘void _avl_rotate(avl_node_t)’:\n/tmp/tmplkmytsa6/c5a51fe6-b445-49ef-bd01-a596f3ddb9e8.cpp:228:66: error: cannot convert ‘bool’ to ‘_avl_which_child_t’ in initialization\n 228 | _avl_which_child_t which = _avl_which_child(node), another = !which;\n | ^~~~~~\n | |\n | bool\n/tmp/tmplkmytsa6/c5a51fe6-b445-49ef-bd01-a596f3ddb9e8.cpp: In function ‘_avl_tree_t* avl_create(compare_function_t, destruct_function_t)’:\n/tmp/tmplkmytsa6/c5a51fe6-b445-49ef-bd01-a596f3ddb9e8.cpp:511:29: error: invalid conversion from ‘void*’ to ‘avl_tree_t’ {aka ‘_avl_tree_t*’} [-fpermissive]\n 511 | avl_tree_t tree = malloc(sizeof(struct _avl_tree_t));\n | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n | |\n | void*\n/tmp/tmplkmytsa6/c5a51fe6-b445-49ef-bd01-a596f3ddb9e8.cpp: In function ‘_avl_node_t* avl_insert(avl_tree_t, void*)’:\n/tmp/tmplkmytsa6/c5a51fe6-b445-49ef-bd01-a596f3ddb9e8.cpp:533:33: error: invalid conversion from ‘void*’ to ‘avl_node_t’ {aka ‘_avl_node_t*’} [-fpermissive]\n 533 | avl_node_t new_node = malloc(sizeof(struct _avl_node_t));\n | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n | |\n | void*\n" | |
| ], | |
| "tcb_id": "维护全序集" | |
| }, | |
| { | |
| "code_id": 8, | |
| "code": "#include<deque>\r\n#include<cstdio>\r\n#include<cctype>\r\n#include<cstring>\r\n#include<iostream>\r\n#include<algorithm>\r\n#define R register\r\n#define ll long long\r\nusing namespace std;\r\n\r\nstruct node\r\n{\r\n\tint pos, val;\r\n};\r\nint t, maxp, w, incos[2100], outcos[2100], inlim[2100], outlim[2100], f[2100][2100], maxx[2100];\r\ndeque<node> a;\r\n\r\ninline void read(int &x)\r\n{\r\n\tx = 0;\r\n\tchar ch = getchar(), w = 0;\r\n\twhile (!isdigit(ch)) w = (ch == '-'), ch = getchar();\r\n\twhile (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();\r\n\tx = w ? -x : x;\r\n\treturn;\r\n}\r\n\r\ninline int max(int a, int b)\r\n{\r\n\treturn a > b ? a : b;\r\n}\r\n\r\nint main()\r\n{\r\n\tmemset(maxx, 128, sizeof(maxx)), memset(f, 128, sizeof(f));\r\n\tf[1][0] = 0;\r\n\tread(t), read(maxp), read(w);\r\n\tfor (R int i = 1; i <= t; ++i)\r\n\t\tread(incos[i]), read(outcos[i]), read(inlim[i]), read(outlim[i]);\r\n\tfor (R int i = 1; i <= w + 1; ++i)\r\n\t\tfor (R int j = 1; j <= inlim[i]; ++j)\r\n\t\t\tf[i][j] = -incos[i] * j;\r\n\tfor (R int i = w + 2; i <= t; ++i)\r\n\t{\r\n\t\tnode in;\r\n\t\tint pos = i - w - 1;\r\n\t\tfor (R int j = 0; j <= maxp; ++j)\r\n\t\t\tmaxx[j] = max(maxx[j], f[pos][j]);\r\n\t\ta.clear();\r\n\t\tfor (R int j = 0; j <= maxp; ++j)\r\n\t\t{\r\n\t\t\tif (!a.empty() && a.back().pos < j - inlim[i])\r\n\t\t\t\ta.pop_back();\r\n\t\t\tin.pos = j, in.val = maxx[j];\r\n\t\t\twhile (!a.empty() && a.front().val + incos[i] * a.front().pos < in.val + incos[i] * in.pos)\r\n\t\t\t\ta.pop_front();\r\n\t\t\ta.push_front(in);\r\n\t\t\tf[i][j] = max(f[i - 1][j], a.back().val - incos[i] * (j - a.back().pos));\r\n\t\t}\r\n\t\ta.clear();\r\n\t\tfor (R int j = maxp; j >= 0; --j)\r\n\t\t{\r\n\t\t\tif (!a.empty() && a.back().pos > j + outlim[i])\r\n\t\t\t\ta.pop_back();\r\n\t\t\tin.pos = j, in.val = maxx[j];\r\n\t\t\twhile (!a.empty() && a.front().val + outcos[i] * a.front().pos < in.val + outcos[i] * in.pos)\r\n\t\t\t\ta.pop_front();\r\n\t\t\ta.push_front(in);\r\n\t\t\tf[i][j] = max(f[i][j], a.back().val + outcos[i] * (a.back().pos - j));\r\n\t\t}\r\n\t}\r\n\tcout << f[t][0] > 0 ? f[t][0] : 0;\r\n\treturn 0;\r\n}", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmp0kp59_zk/b39f4398-d047-4516-8c1f-2fed15af22c4.cpp: In function ‘int main()’:\n/tmp/tmp0kp59_zk/b39f4398-d047-4516-8c1f-2fed15af22c4.cpp:72:25: error: ordered comparison of pointer with integer zero (‘void*’ and ‘int’)\n 72 | cout << f[t][0] > 0 ? f[t][0] : 0;\n | ~~~~~~~~~~~~~~~~^~~\n" | |
| ], | |
| "tcb_id": "股票交易" | |
| }, | |
| { | |
| "code_id": 1, | |
| "code": "#pragma GCC optimize(3)\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC optimize(\"inline\")\n#pragma GCC optimize(\"-fgcse\")\n#pragma GCC optimize(\"-fgcse-lm\")\n#pragma GCC optimize(\"-fipa-sra\")\n#pragma GCC optimize(\"-ftree-pre\")\n#pragma GCC optimize(\"-ftree-vrp\")\n#pragma GCC optimize(\"-fpeephole2\")\n#pragma GCC optimize(\"-ffast-math\")\n#pragma GCC optimize(\"-fsched-spec\")\n#pragma GCC optimize(\"unroll-loops\")\n#pragma GCC optimize(\"-falign-jumps\")\n#pragma GCC optimize(\"-falign-loops\")\n#pragma GCC optimize(\"-falign-labels\")\n#pragma GCC optimize(\"-fdevirtualize\")\n#pragma GCC optimize(\"-fcaller-saves\")\n#pragma GCC optimize(\"-fcrossjumping\")\n#pragma GCC optimize(\"-fthread-jumps\")\n#pragma GCC optimize(\"-funroll-loops\")\n#pragma GCC optimize(\"-fwhole-program\")\n#pragma GCC optimize(\"-freorder-blocks\")\n#pragma GCC optimize(\"-fschedule-insns\")\n#pragma GCC optimize(\"inline-functions\")\n#pragma GCC optimize(\"-ftree-tail-merge\")\n#pragma GCC optimize(\"-fschedule-insns2\")\n#pragma GCC optimize(\"-fstrict-aliasing\")\n#pragma GCC optimize(\"-fstrict-overflow\")\n#pragma GCC optimize(\"-falign-functions\")\n#pragma GCC optimize(\"-fcse-skip-blocks\")\n#pragma GCC optimize(\"-fcse-follow-jumps\")\n#pragma GCC optimize(\"-fsched-interblock\")\n#pragma GCC optimize(\"-fpartial-inlining\")\n#pragma GCC optimize(\"no-stack-protector\")\n#pragma GCC optimize(\"-freorder-functions\")\n#pragma GCC optimize(\"-findirect-inlining\")\n#pragma GCC optimize(\"-fhoist-adjacent-loads\")\n#pragma GCC optimize(\"-frerun-cse-after-loop\")\n#pragma GCC optimize(\"inline-small-functions\")\n#pragma GCC optimize(\"-finline-small-functions\")\n#pragma GCC optimize(\"-ftree-switch-conversion\")\n#pragma GCC optimize(\"-foptimize-sibling-calls\")\n#pragma GCC optimize(\"-fexpensive-optimizations\")\n#pragma GCC optimize(\"-funsafe-loop-optimizations\")\n#pragma GCC optimize(\"inline-functions-called-once\")\n#pragma GCC optimize(\"-fdelete-null-pointer-checks\")\n#include <stdio.h>\n#include <assert.h>\n#include <dlfcn.h>\n#include <string.h>\n#include <gmp.h>\n#include <string>\n#include <unordered_map>\n\nusing namespace std;\n\nstatic_assert(sizeof(unsigned long) == 8);\n\n// dynamic loading for LOJ (useful for machine that is not Intel)\n// for Intel : use setenv(\"LD_PRELOAD\", LIB_PATH, 1) and popen+objdump (but need to access fork() / pipe() and memory allocate)\nstruct DLL \n{\n void *handle;\n unordered_map<string, void *> syms;\n DLL(const char *file) : handle(dlopen(file, RTLD_LAZY)) {}\n ~DLL() { dlclose(handle); }\n void *find_name(const char *name) \n {\n if (unordered_map<string, void *>::iterator it = syms.find(name); it != syms.end()) \n return it->second;\n else\n return syms[name] = dlsym(handle, name);\n }\n template <typename R = void, typename... T>\n R call(const char *name, T... t) \n {\n auto func = reinterpret_cast<R(*)(T...)>(find_name(name));\n return func(t...);\n };\n};\n\nDLL GMP(\"/usr/lib/x86_64-linux-gnu/libgmp.so.10\");\n\nstruct fastIO\n{\n static const int BUFF_SZ = 1 << 18;\n char inbuf[BUFF_SZ], outbuf[BUFF_SZ];\n fastIO()\n {\n setvbuf(stdin, inbuf, _IOFBF, BUFF_SZ);\n setvbuf(stdout, outbuf, _IOFBF, BUFF_SZ);\n }\n} IO;\nint radix_a, radix_b;\nint len_a, len_b;\nchar A[1000005], B[1000005];\nint main()\n{\n scanf(\"%d%d%s\", &radix_a, &radix_b, A);\n mpz_t a;\n GMP.call(\"__gmpz_init\", a);\n GMP.call(\"__gmpz_set_str\", a, A, radix_a);\n GMP.call(\"__gmpz_get_str\", B, radix_b, a);\n puts(B);\n GMP.call(\"__gmpz_clear\", a);\n}\n", | |
| "status": [ | |
| "CE" | |
| ], | |
| "details": [ | |
| "/tmp/tmpc9wzt929/556099b8-257f-448f-811f-b3b6adc28675.cpp:51:10: fatal error: gmp.h: No such file or directory\n 51 | #include <gmp.h>\n | ^~~~~~~\ncompilation terminated.\n" | |
| ], | |
| "tcb_id": "高精度进制转换" | |
| } | |
| ] |
Xet Storage Details
- Size:
- 241 kB
- Xet hash:
- f0383c71d7da682bb4697fefa86aa65e5d662b781a1b89a8a4194fc098a7d411
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.