Tasks Details
easy
Find the missing element in a given permutation.
Task Score
30%
Correctness
60%
Performance
0%
An array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing.
Your goal is to find that missing element.
Write a function:
class Solution { public int solution(int[] A); }
that, given an array A, returns the value of the missing element.
For example, given array A such that:
A[0] = 2 A[1] = 3 A[2] = 1 A[3] = 5the function should return 4, as it is the missing element.
Write an efficient algorithm for the following assumptions:
- N is an integer within the range [0..100,000];
- the elements of A are all distinct;
- each element of array A is an integer within the range [1..(N + 1)].
Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.
Solution
Programming language used C#
Time spent on task 9 minutes
Notes
not defined yet
Task timeline
Code: 12:15:06 UTC,
c,
verify,
result: Failed
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
// you can write to stdout for debugging purposes, e.g.
// printf("this is a debug message\n");
long solution(long A[], long N) {
// write your code in C99
//printf("N = %d\n", N);
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
long nthPosition = -1;
long nPlusOnePosition = -1;
long i = 0;
while(i < N)
{
long elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(long i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 0;
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
Analysis
expand all
Example tests
1.
0.006 s
RUNTIME ERROR,
tested program terminated unexpectedly
stderr:
Segmentation Fault
expand all
User tests
1.
0.006 s
RUNTIME ERROR,
tested program terminated unexpectedly
stderr:
Segmentation Fault
1.
0.006 s
RUNTIME ERROR,
tested program terminated unexpectedly
stderr:
Segmentation Fault
Code: 12:16:19 UTC,
cpp,
verify,
result: Failed
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
// you can write to stdout for debugging purposes, e.g.
// printf("this is a debug message\n");
int solution(int A[], int N) {
// write your code in C99
//printf("N = %d\n", N);
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
long nthPosition = -1;
long nPlusOnePosition = -1;
long i = 0;
while(i < N)
{
long elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(long i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 0;
}
Analysis
Compile error
main.o: In function `main': /tmp/user.cpp:114: undefined reference to `solution(std::vector<int, std::allocator<int> >&)' collect2: error: ld returned 1 exit status
Code: 12:16:36 UTC,
c,
verify,
result: Passed
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
// you can write to stdout for debugging purposes, e.g.
// printf("this is a debug message\n");
int solution(int A[], int N) {
// write your code in C99
//printf("N = %d\n", N);
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
long nthPosition = -1;
long nPlusOnePosition = -1;
long i = 0;
while(i < N)
{
long elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(long i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 0;
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
Analysis
Code: 12:17:45 UTC,
cpp,
verify,
result: Failed
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
// you can write to stdout for debugging purposes, e.g.
// printf("this is a debug message\n");
int solution(int A[], int N) {
// write your code in C99
//printf("N = %d\n", N);
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
long nthPosition = -1;
long nPlusOnePosition = -1;
long i = 0;
while(i < N)
{
long elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(long i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 0;
}
Analysis
Compile error
main.o: In function `main': /tmp/user.cpp:114: undefined reference to `solution(std::vector<int, std::allocator<int> >&)' collect2: error: ld returned 1 exit status
Code: 12:20:10 UTC,
cs,
verify,
result: Failed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
intlo elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(int i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 0;
}
}
Analysis
Compile error
Compilation failed: 1 error(s), 0 warnings Solution.cs(55,21): error CS0136: A local variable named `i' cannot be declared in this scope because it would give a different meaning to `i', which is already used in a `parent or current' scope to denote something else
Code: 12:20:29 UTC,
cs,
verify,
result: Failed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
intlo elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 0;
}
}
Analysis
Compile error
Compilation failed: 10 error(s), 0 warnings Solution.cs(20,13): error CS0246: The type or namespace name `intlo' could not be found. Are you missing an assembly reference? Solution.cs(22,17): error CS0841: A local variable `elem' cannot be used before it is declared Solution.cs(24,31): error CS0841: A local variable `elem' cannot be used before it is declared Solution.cs(27,22): error CS0841: A local variable `elem' cannot be used before it is declared Solution.cs(29,36): error CS0841: A local variable `elem' cannot be used before it is declared Solution.cs(34,23): error CS0841: A local variable `elem' cannot be used before it is declared Solution.cs(34,32): error CS0841: A local variable `elem' cannot be used before it is declared Solution.cs(36,31): error CS0841: A local variable `elem' cannot be used before it is declared Solution.cs(36,23): error CS0841: A local variable `elem' cannot be used before it is declared Solution.cs(37,25): error CS0841: A local variable `elem' cannot be used before it is declared
Code: 12:20:46 UTC,
cs,
verify,
result: Passed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
int elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 0;
}
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
Analysis
Code: 12:21:05 UTC,
cs,
verify,
result: Passed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
int elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 1;
}
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
User test case 3:
[]
Analysis
expand all
User tests
1.
0.054 s
OK
function result: 2
function result: 2
1.
0.054 s
OK
function result: 2
function result: 2
1.
0.053 s
OK
function result: 0
function result: 0
Code: 12:21:22 UTC,
cs,
verify,
result: Passed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
int elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
return 1;
}
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
User test case 3:
[]
Analysis
expand all
User tests
1.
0.059 s
OK
function result: 2
function result: 2
1.
0.059 s
OK
function result: 2
function result: 2
1.
0.059 s
OK
function result: 0
function result: 0
Code: 12:21:51 UTC,
cs,
verify,
result: Passed
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
int elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
Console.WriteLine("this is a debug message");
return 1;
}
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
User test case 3:
[]
Analysis
expand all
User tests
1.
0.060 s
OK
function result: 2
function result: 2
1.
0.059 s
OK
function result: 2
function result: 2
1.
0.058 s
OK
function result: 0
function result: 0
Code: 12:22:38 UTC,
cs,
verify,
result: Passed
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
int elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
Console.WriteLine("this is a debug message");
return 1;
}
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
User test case 3:
[]
User test case 4:
[1]
Analysis
expand all
User tests
1.
0.059 s
OK
function result: 2
function result: 2
1.
0.058 s
OK
function result: 2
function result: 2
1.
0.058 s
OK
function result: 0
function result: 0
1.
0.059 s
OK
function result: 2
function result: 2
Code: 12:23:23 UTC,
cs,
verify,
result: Passed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
if (N <= 0) { return 1;}
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
int elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
Console.WriteLine("this is a debug message");
return 1;
}
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
User test case 3:
[]
User test case 4:
[1]
Analysis
expand all
User tests
1.
0.058 s
OK
function result: 2
function result: 2
1.
0.058 s
OK
function result: 2
function result: 2
1.
0.057 s
OK
function result: 1
function result: 1
1.
0.058 s
OK
function result: 2
function result: 2
Code: 12:23:37 UTC,
cs,
verify,
result: Passed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
if (N <= 0) { return 1;}
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
int elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
Console.WriteLine("this is a debug message");
return 1;
}
}
User test case 1:
[3, 1]
User test case 2:
[1, 3]
User test case 3:
[]
User test case 4:
[1]
Analysis
expand all
User tests
1.
0.059 s
OK
function result: 2
function result: 2
1.
0.059 s
OK
function result: 2
function result: 2
1.
0.059 s
OK
function result: 1
function result: 1
1.
0.060 s
OK
function result: 2
function result: 2
Code: 12:23:42 UTC,
cs,
final,
score: 
30
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int N = A.Length;
if (N <= 0) { return 1;}
//instead of resizing the array, I will use two ints to contain the Nth and (N+1)th elements
int nthPosition = -1;
int nPlusOnePosition = -1;
int i = 0;
while(i < N)
{
int elem = A[i];
if (elem == N)
{
nthPosition = elem;
i++;
}
else if (elem == N + 1)
{
nPlusOnePosition = elem;
i++;
}
else
{
if (A[elem] != elem)
{
A[elem] = elem;
i = elem;
}
else
{
i++;
}
}
}
//printf("nthPosition = %d\n", nthPosition);
//printf("nPlusOnePosition = %d\n", nPlusOnePosition);
//if the value of nthPosition did not change, then N is the missing number...
if (nthPosition == -1) { return N; }
else if (nPlusOnePosition == -1) { return N+1; }
else
{
// you can replace this with O(log(n)) next time
for(i = 1; i < N; i++)
{
if (A[i] != i)
{
return i;
}
}
}
Console.WriteLine("this is a debug message");
return 1;
}
}
Analysis summary
The following issues have been detected: wrong answers.
For example, for the input [1, 2] the solution returned a wrong answer (got 2 expected 3).
Analysis
expand all
Correctness tests
1.
0.059 s
OK
2.
0.060 s
OK
1.
0.060 s
OK
2.
0.060 s
OK
1.
0.059 s
OK
2.
0.059 s
OK
1.
0.059 s
WRONG ANSWER,
got 2 expected 3
2.
0.059 s
OK
3.
0.058 s
OK
1.
0.060 s
WRONG ANSWER,
got 8 expected 7
expand all
Performance tests
1.
0.063 s
WRONG ANSWER,
got 9999 expected 456
1.
0.063 s
WRONG ANSWER,
got 9999 expected 9998
1.
0.094 s
WRONG ANSWER,
got 100000 expected 100001
2.
0.080 s
WRONG ANSWER,
got 49999 expected 1
3.
0.076 s
WRONG ANSWER,
got 49998 expected 12345
1.
0.095 s
WRONG ANSWER,
got 100000 expected 76541
1.
0.081 s
WRONG ANSWER,
got 60049 expected 10001