Submission #4274

# Submission time Handle Problem Language Result Execution time Memory
4274 2013-09-10T12:51:01 Z ansol4328 줄 세우기 (KOI13_jul) C++
22 / 22
176 ms 12804 KB
#include<stdio.h> 
  
int n, m[1000002]; 
int p[1000002]; 
int dy[1000002]; 
int max; 
  
int input() 
{ 
    int i; 
  
    scanf("%d",&n); 
    for(i=1 ; i<=n ; i++) 
    { 
        scanf("%d",&m[i]); 
        p[m[i]]=i; 
    } 
    return 0; 
} 
  
int process() 
{ 
    int i; 
  
    for(i=1 ; i<=n ; i++) 
    { 
        dy[i]=1; 
        if(p[i-1]<p[i] && dy[i]<dy[i-1]+1) 
        { 
            dy[i]=dy[i-1]+1; 
        } 
        if(max<dy[i]) 
        { 
            max=dy[i]; 
        } 
    } 
    return 0; 
} 
  
int output() 
{ 
    printf("%d",n-max); 
    return 0; 
} 
  
int main() 
{ 
    input(); 
    process(); 
    output(); 
    return 0; 
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 12804 KB Output is correct
2 Correct 0 ms 12804 KB Output is correct
3 Correct 0 ms 12804 KB Output is correct
4 Correct 0 ms 12804 KB Output is correct
5 Correct 0 ms 12804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 12804 KB Output is correct
2 Correct 0 ms 12804 KB Output is correct
3 Correct 0 ms 12804 KB Output is correct
4 Correct 0 ms 12804 KB Output is correct
5 Correct 0 ms 12804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 12804 KB Output is correct
2 Correct 0 ms 12804 KB Output is correct
3 Correct 0 ms 12804 KB Output is correct
4 Correct 0 ms 12804 KB Output is correct
5 Correct 0 ms 12804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 12804 KB Output is correct
2 Correct 4 ms 12804 KB Output is correct
3 Correct 12 ms 12804 KB Output is correct
4 Correct 28 ms 12804 KB Output is correct
5 Correct 52 ms 12804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 12804 KB Output is correct
2 Correct 120 ms 12804 KB Output is correct
3 Correct 140 ms 12804 KB Output is correct
4 Correct 176 ms 12804 KB Output is correct
5 Correct 132 ms 12804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 172 ms 12804 KB Output is correct
2 Correct 160 ms 12804 KB Output is correct
3 Correct 168 ms 12804 KB Output is correct
4 Correct 176 ms 12804 KB Output is correct
5 Correct 172 ms 12804 KB Output is correct