社区讨论
求解,为啥我的暴力跑这么快
灌水区参与者 5已保存回复 8
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 8 条
- 当前快照
- 1 份
- 快照标识符
- @lp4nanda
- 此快照首次捕获于
- 2023/11/19 06:53 2 年前
- 此快照最后确认于
- 2023/11/19 11:27 2 年前
NOIP T1 luogu 总共 ms
按理说不是能卡到接近 吗
CPP/*
AFO
写一下退役感言吧。
不对啊,去年不是写过了吗/hsh
建议去 NOIP 2022 T1 我的代码上找吧,不想再写了
luogu uid: 396974
//freopen
嘻嘻,诈骗你一手
*/
#include<bits/stdc++.h>
#define pb push_back
typedef long long ll;
int read() {
int res = 0, f = 0; char ch = getchar();
for(; !isdigit(ch); ch = getchar()) f |= (ch == '-');
for(; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + (ch -'0');
return f ? -res : res;
}
const int Maxn = 3100;
char ch[Maxn][Maxn];
char Max[Maxn][Maxn];
char Min[Maxn][Maxn];
char ans[Maxn];
int n, m;
signed main() {
// return system("fc dict4.ans dict.out"), 0;
// freopen("dict.in", "r", stdin); 再骗你一次,嘻嘻
// freopen("dict.out", "w", stdout); 再骗你一次,嘻嘻
n = read(), m = read();
if(n == 1) return puts("1"), 0;
for(int i = 1; i <= n; i++) scanf("%s", ch[i] + 1);
for(int i = 1; i <= n; i++) {
std::sort(ch[i] + 1, ch[i] + m + 1);
for(int j = 1; j <= m; j++) Min[i][j] = ch[i][j], Max[i][j] = ch[i][m - j + 1];
}
for(int i = 1; i <= n; i++) {
bool f = 0;
for(int j = 1; j <= n; j++) {
if(j == i) continue;
int l = 1;
while(Min[i][l] == Max[j][l]) l++;
if(Min[i][l] >= Max[j][l]) f = 1;
if(f) break;
}
if(f) ans[i] = '0';
else ans[i] = '1';
}
for(int i = 1; i <= n; i++) putchar(ans[i]);
fclose(stdin);
fclose(stdout);
return 0;
}
回复
共 8 条回复,欢迎继续交流。
正在加载回复...