Submission #524341

# Submission time Handle Problem Language Result Execution time Memory
524341 2022-02-09T04:39:03 Z iskhakkutbilim Table Tennis (info1cup20_tabletennis) C++14
11 / 100
3000 ms 4596 KB
// Author: Tazhibaev Iskhak
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<int, int> ,null_type,less< pair<int, int> >,rb_tree_tag,
	tree_order_statistics_node_update> ordered_set;
const long double pi = acos((long double) - 1.0);
const double eps = (double)1e-9;
const int INF = 1e9 + 7;
    #define ff         first
    #define ss         second
    #define ll         long long
    #define ld		   long double
    #define pb         push_back
void usaco( string filename){
  freopen((filename+".in").c_str(), "r", stdin);
  freopen((filename+".out").c_str(), "w", stdout);
}




main(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(nullptr); cout.tie(nullptr);
	 int n, k; cin >> n >> k;
	 vector<int> a(n + k);
	 for(int i = 0;i < n + k; i++){
	 	cin >> a[i];
	 }
	 
	 function <bool(vector<int>) > good = [&](vector<int> s){
	 	for(int i = 0;i < n; i++){
	 		int j = i + 1;
	 		if(j >= n or (n - i - 1) < 0 or (n - j - 1) < 0) break;
	 		if(s[i] + s[n-i-1] != s[j] + s[n-j-1]) return false;
	 	}
	 	return true;
	 };
	 
	 for(int i = 0;i < n + k; i++){
	 	vector<int> sub;
	 	for(int j = 0;j < n + k; j++){
	 		if(i != j) sub.push_back(a[j]);
	 	}
	 	if(good(sub)){
	 		for(auto to : sub) cout << to << " ";
	 		return 0;
	 	}
	 }
    return 0;
}

Compilation message

tabletennis.cpp:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   27 | main(){
      | ^~~~
tabletennis.cpp: In function 'void usaco(std::string)':
tabletennis.cpp:20:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   freopen((filename+".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tabletennis.cpp:21:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   freopen((filename+".out").c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 9 ms 316 KB Output is correct
3 Correct 8 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 623 ms 656 KB Output is correct
2 Correct 29 ms 4596 KB Output is correct
3 Execution timed out 3051 ms 4516 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 3000 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Extra information in the output file
2 Halted 0 ms 0 KB -