Submission #18627491


Source Code Expand

Copy
#import <Foundation/Foundation.h>
 
int main(int argc, const char * argv[]) {
    //@autoreleasepool {
 
        NSData *stdinData = [[NSFileHandle fileHandleWithStandardInput] availableData];
        NSString *stdinString = [[NSString alloc] initWithData:stdinData encoding:NSUTF8StringEncoding];
        NSMutableArray<NSMutableArray<NSString *> *> *stdinStrArr = [NSMutableArray new];
        for (NSString *str in [stdinString componentsSeparatedByString:@"\n"]) {
            [stdinStrArr addObject:[[str componentsSeparatedByString:@" "] mutableCopy]];
        }
 
        NSMutableArray<NSNumber *> *aList = [NSMutableArray new];
        for (NSString *i in [stdinStrArr objectAtIndex:1]) {
            NSNumber *currentIndex = [NSNumber numberWithLongLong:[i longLongValue]];
            long long replaceIndex = [currentIndex longLongValue] - 1;
            [aList addObject:[NSNumber numberWithLongLong:0]];
            NSNumber *newValue = [NSNumber numberWithLongLong:[[aList objectAtIndex:replaceIndex] longLongValue] + 1];
            [aList replaceObjectAtIndex:replaceIndex withObject:newValue];
        }
        [aList addObject:[NSNumber numberWithLongLong:0]];
 
        NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
 
        for (NSNumber *n in aList) {
            [fileHandle writeData:[[NSString stringWithFormat:@"%@", n] dataUsingEncoding:NSUTF8StringEncoding]];
            [fileHandle writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];
        }
        [fileHandle closeFile];
 
    //}
    return 0;
}

Submission Info

Submission Time
Task C - management
User log5
Language Objective-C (Clang 10.0.0)
Score 0
Code Size 1598 Byte
Status TLE
Exec Time 2251 ms
Memory 64788 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 4
TLE × 11
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All binary_01, binary_02, line_01, line_02, random_01, random_02, random_03, random_04, sample_01, sample_02, sample_03, small_01, star_01, star_02, star_03
Case Name Status Exec Time Memory
binary_01 TLE 2249 ms 64348 KB
binary_02 TLE 2250 ms 64360 KB
line_01 TLE 2250 ms 64788 KB
line_02 TLE 2250 ms 64392 KB
random_01 TLE 2250 ms 64484 KB
random_02 TLE 2248 ms 62972 KB
random_03 TLE 2250 ms 63432 KB
random_04 TLE 2248 ms 59536 KB
sample_01 AC 141 ms 16792 KB
sample_02 AC 139 ms 16792 KB
sample_03 AC 140 ms 16812 KB
small_01 AC 138 ms 16804 KB
star_01 TLE 2250 ms 62876 KB
star_02 TLE 2251 ms 63344 KB
star_03 TLE 2249 ms 63668 KB