Submission #684579

# Submission time Handle Problem Language Result Execution time Memory
684579 2023-01-21T20:04:15 Z koolaider Autići (COCI22_autici) C++17
50 / 50
51 ms 2044 KB
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
 
void setIO(string s) {
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}
 
 
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define pb push_back
#define ll long long
 
const long long MN = 2e9;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//func(Zeal){Try to make things logical for you, be less pressured}
// Draw cases
// Try to find the pattern
// chill confidence
 
 
/*
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("Ofast")
*/

//const long long ML = 1e18;
//const int MN = 1e9;

const int MM = 1e9+7;

int main(int argc, char **argv){
	//ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);	
	//setIO("feast");
	int n; cin >> n;
	vector<ll> parts(n);
	for(int i = 0; i<n; i++){
		cin >> parts[i];
	}
	sort(parts.begin(), parts.end());
	ll ans = 0;
	
	for(int i = 1; i<n; i++){
		ans+=parts[0]+parts[i];
		}
	
	cout << ans;
	
	
	return 0;
}



Compilation message

Main.cpp: In function 'void setIO(std::string)':
Main.cpp:6:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  freopen((s + ".in").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:7:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  freopen((s + ".out").c_str(), "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 14 ms 1108 KB Output is correct
3 Correct 39 ms 1924 KB Output is correct
4 Correct 34 ms 1880 KB Output is correct
5 Correct 47 ms 1960 KB Output is correct
6 Correct 32 ms 1832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 14 ms 1108 KB Output is correct
3 Correct 39 ms 1924 KB Output is correct
4 Correct 34 ms 1880 KB Output is correct
5 Correct 47 ms 1960 KB Output is correct
6 Correct 32 ms 1832 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 14 ms 1236 KB Output is correct
22 Correct 39 ms 1996 KB Output is correct
23 Correct 37 ms 2044 KB Output is correct
24 Correct 41 ms 1896 KB Output is correct
25 Correct 43 ms 1952 KB Output is correct
26 Correct 39 ms 1884 KB Output is correct
27 Correct 43 ms 1944 KB Output is correct
28 Correct 39 ms 1764 KB Output is correct
29 Correct 51 ms 1952 KB Output is correct
30 Correct 38 ms 1900 KB Output is correct