Submission #667674

# Submission time Handle Problem Language Result Execution time Memory
667674 2022-12-01T21:17:54 Z hyakup Table Tennis (info1cup20_tabletennis) C++17
20 / 100
80 ms 2332 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long

const int maxn = 150010;

int v[maxn];

int main(){
    
    int n, k; scanf("%d %d", &n, &k );
    
    for( int i = 1; i <= n + k; i++ ) scanf("%d", &v[i] );
    
    
    for( int i = 1; i <= n + k; i++ ){
        
        int l = 1, r = n + k; 
        int soma = -1;
        
        bool ok = true;
        
        while( l < r ){
        
            if( l == i ) l++;
            if( r == i ) r--;
        
            if( soma == -1 ) soma = v[l] + v[r];
            else if( v[l] + v[r] != soma ){
                
                ok = false;
                
                break;
            }
            
            l++, r--;
        }
        
        if( ok ){
            
            for( int j = 1; j <= n + k; j++){
                
                if( j == i ) continue;
                
                printf("%d ", v[j] );
                
            }
            break;
        }
    }
    
    return 0;
}

Compilation message

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:12:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     int n, k; scanf("%d %d", &n, &k );
      |               ~~~~~^~~~~~~~~~~~~~~~~~
tabletennis.cpp:14:44: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     for( int i = 1; i <= n + k; i++ ) scanf("%d", &v[i] );
      |                                       ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 496 KB Output is correct
2 Correct 26 ms 2332 KB Output is correct
3 Correct 29 ms 2272 KB Output is correct
4 Correct 27 ms 2264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 832 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -