Submission #44604638
Source Code Expand
library(stringr)
library(zeallot)
conn <- file("stdin", open="r")
readLine <- function() {
input <- readLines(conn, n=1)
ret <- unlist(strsplit(input, " "))
return(ret)
}
c(N, M) %<-% as.integer(readLine())
S <- readLine()
C <- as.integer(readLine())
A <- array(0, M)
S <- str_split_1(S, "")
for (i in N:1) {
# cat("i=", i, "\n")
color <- C[i]
j <- A[color]
if (j != 0) {
c(S[i], S[j]) %<-% c(S[j], S[i])
}
A[color] <- i
}
S <- str_c(S, collapse="")
cat(S)
cat("\n")
close(conn)
Submission Info
| Submission Time | |
|---|---|
| Task | C - Rotate Colored Subsequence |
| User | bo9chan |
| Language | R (GNU R 4.2.1) |
| Score | 0 |
| Code Size | 559 Byte |
| Status | TLE |
| Exec Time | 2213 ms |
| Memory | 95688 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 300 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 285 ms | 75200 KiB |
| 001.txt | TLE | 2213 ms | 95560 KiB |
| 002.txt | AC | 478 ms | 91724 KiB |
| 003.txt | TLE | 2213 ms | 95536 KiB |
| 004.txt | TLE | 2213 ms | 95688 KiB |
| 005.txt | TLE | 2213 ms | 95532 KiB |
| 006.txt | TLE | 2213 ms | 92644 KiB |
| 007.txt | AC | 770 ms | 80040 KiB |
| 008.txt | TLE | 2213 ms | 93300 KiB |
| 009.txt | AC | 1378 ms | 92708 KiB |
| 010.txt | TLE | 2213 ms | 95560 KiB |
| 011.txt | TLE | 2213 ms | 95688 KiB |
| 012.txt | TLE | 2212 ms | 95536 KiB |
| 013.txt | TLE | 2213 ms | 95424 KiB |
| 014.txt | TLE | 2213 ms | 95348 KiB |
| 015.txt | TLE | 2213 ms | 95444 KiB |
| 016.txt | TLE | 2213 ms | 95632 KiB |
| 017.txt | TLE | 2213 ms | 95644 KiB |
| 018.txt | TLE | 2213 ms | 95420 KiB |
| 019.txt | TLE | 2213 ms | 95504 KiB |
| 020.txt | TLE | 2213 ms | 95640 KiB |
| 021.txt | TLE | 2213 ms | 95488 KiB |
| 022.txt | TLE | 2213 ms | 95344 KiB |
| 023.txt | TLE | 2213 ms | 95384 KiB |
| 024.txt | TLE | 2213 ms | 95372 KiB |
| 025.txt | TLE | 2213 ms | 95444 KiB |
| 026.txt | TLE | 2212 ms | 95340 KiB |
| example0.txt | AC | 281 ms | 75112 KiB |
| example1.txt | AC | 286 ms | 75320 KiB |