結果
| 問題 |
No.2162 Copy and Paste 2
|
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2022-12-13 12:27:49 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,256 bytes |
| コンパイル時間 | 1,154 ms |
| コンパイル使用メモリ | 30,208 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 08:21:53 |
| 合計ジャッジ時間 | 2,276 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 4 WA * 22 |
ソースコード
#include <stdio.h>
#define INF 2000000000
void set_segt (int *t, int idx, int val, int size) {
idx = idx+size-1;
t[idx] = val;
while (idx > 0) {
idx = (idx-1)/2;
t[idx] = t[2*idx+1];
if (t[2*idx+2] > t[2*idx+1]) {
t[idx] = t[2*idx+2];
}
}
return;
}
int max_segt_rec (int *t, int a, int b, int k, int l, int r) {
int ans = 0;
int tmp = 0;
if (r <= a || b <= l) {
return -INF;
}
if (a <= l && r <= b) {
return t[k];
}
ans = max_segt_rec(t, a, b, 2*k+1, l, (l+r)/2);
tmp = max_segt_rec(t, a, b, 2*k+2, (l+r)/2, r);
if (ans < tmp) {
ans = tmp;
}
return ans;
}
int max_segt (int *t, int a, int b, int size) {
return max_segt_rec(t, a, b, 0, 0, size);
}
int bin_search_segt (int *t, int a, int b, int k, int size) {
return -1;
}
int main () {
char s[200001] = "";
int res = 0;
int len = 0;
int z[200000] = {};
int size = 1;
int tz[600000] = {};
int tm[600000] = {};
int idx = 0;
res = scanf("%s", s);
while (s[len] != '\0') {
len++;
}
while (size <= len) {
size <<= 1;
}
for (int i = 0; i < len; i++) {
set_segt(tm, i, -len, size);
}
printf("%d\n", (-1)*max_segt(tm, 0, len, size));
return 0;
}
chro_96