Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
60409 yangkangrui S2 C++ 解答错误 40 7 MS 572 KB 4309 2022-10-15 11:30:16

Tests(4/10):


#include <iostream> #include <cstdio> using namespace std; #define fprintf(...) int read() { int x=0,f=1;char c=getchar(); while(!(c>='0'&&c<='9')){if(c=='-')f=-f;c=getchar();} while(c>='0'&&c<='9'){x=x*10+c-48;c=getchar();} return x*f; } int n, m; const int maxn = 1e5 + 100; int a[maxn]; void ch1() { // task 1 // m == 0 for (int i = 1; i <= n; i++) printf("%d ", 0); printf("\n"); } bool ch2f = true; void ch2() { // task 6, 7 (2, 3) // m == 1, 2, 3 needs if (m == 1) { int i = 6; while (i <= n) { printf("%d %d %d %d %d %d ", i - 4, i - 4, i - 2, i - 2, i, i); i += 6; } for (; i <= n; i++) { printf("%d ", i / 2 * 2 + 2); } return; } if (m == 2) { int i = 6; while (i <= n) { printf("%d %d %d %d %d %d ", i - 3, i - 3, i, i, i, i); i += 6; } for (; i <= n; i++) { printf("%d ", i / 3 * 3 + 3); } printf("\n"); return; } if (m == 3) { int i = 6; while (i <= n) { printf("%d %d %d %d %d %d ", i - 2, i - 2, i, i, i, i); i += 6; } for (; i <= n; i++) { int tt = i % 6; if (tt >= 1 && tt <= 4) { printf("%d ", i / 6 * 6 + 4); break; } else { printf("%d ", i / 6 * 6 + 6); break; } } printf("\n"); return; } int i = 6; while (i <= n) { printf("%d %d %d %d %d %d ", i, i, i, i, i, i); i += 6; } for (; i <= n; i++) { printf("%d ", i / 6 * 6 + 6); } printf("\n"); return; } bool ch5f = true; void ch5() { // task 6, 7 (3, 2) // m == 1, 2 needs if (m == 1) { int i = 6; while (i <= n) { printf("%d %d %d %d %d %d ", i - 3, i - 3, i - 3, i, i, i); i += 6; } for (; i <= n; i++) { printf("%d ", i / 3 * 3 + 3); } return; } if (m == 2) { int i = 6; while (i <= n) { printf("%d %d %d %d %d %d ", i - 2, i - 2, i - 2, i, i, i); i += 6; } for (; i <= n; i++) { int tt = i % 6; if (tt >= 1 && tt <= 3) printf("%d ", i / 6 * 6 + 4); else printf("%d ", i / 6 * 6 + 6); } printf("\n"); return; } int i = 6; while (i <= n) { printf("%d %d %d %d %d %d ", i, i, i, i, i, i); i += 6; } for (; i <= n; i++) { printf("%d ", i / 6 * 6 + 6); } printf("\n"); return; } void ch3() { // task 2, 3 // m == 1 for (int i = 1; i <= n; i++) { printf("%d ", i / a[1] * a[1] + a[1] * int(bool(i % a[1]))); } printf("\n"); } int sa[maxn]; void ch4() { // task 4, 5 for (int i = 1; i <= n; i++) sa[i] = i; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { sa[j] = sa[j] / a[i] * a[i] + a[i] * int(bool(sa[j] % a[i])); } } for (int i = 1; i <= n; i++) printf("%d ", sa[i]); printf("\n"); } void ch6() { // ans equ int sk = 1; for (int i = 1; i <= m; i++) { sk = sk / a[i] * a[i] + a[i] * int(bool(sk % a[i])); } for (int i = 1; i <= n; i++) printf("%d ", sk); printf("\n"); } int main() { // freopen("S2.in", "r", stdin); // freopen("S2.out", "w", stdout); n = read(); m = read(); for (int i = 1; i <= m; i++) { a[i] = read(); if (ch2f && (i & 1) && (a[i] != 2)) ch2f = false; if (ch2f && (!(i & 1)) && (a[i] != 3)) ch2f = false; if (ch5f && (i & 1) && (a[i] != 3)) ch5f = false; if (ch5f && (!(i & 1)) && (a[i] != 2)) ch5f = false; fprintf(stdout, "%d: %d\n", i, int(ch2f)); } if (ch2f) {ch2(); return 0;} if (ch5f) {ch5(); return 0;} if (m == 0) { ch1(); return 0; } if (m == 1) { ch3(); return 0; } if (n <= 1000 && m <= 1000) { ch4(); return 0; } // ch6(); return 0; }


测评信息: