답안 #86407

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86407 2018-11-26T09:18:36 Z dimash241 Hindeks (COCI17_hindeks) C++17
컴파일 오류
0 ms 0 KB
# include <stdio.h>
# include <bits/stdc++.h>


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 1e6 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;

int main () {               
    cin >> n;
    For (i, 1, n) {
    	cin >> a[i];
    	cnt[a[i]] ++;
    }
    sort(a + 1, a + n + 1);

    For (i, 0, 1e6) {
    	if (i == n - cur) {
    		cout << i;
    		exit(0);
    	}
    	cur += cnt[i];
    }
    cout << a[n] + 1;
    return Accepted;
}

// Coded By OB# include <stdio.h>
# include <bits/stdc++.h>


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 1e6 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;

int main () {               
    cin >> n;
    For (i, 1, n) {
    	cin >> a[i];
    	cnt[a[i]] ++;
    }
    sort(a + 1, a + n + 1);

    For (i, 0, 1e6) {
    	if (i == n - cur) {
    		cout << i;
    		exit(0);
    	}
    	cur += cnt[i];
    }
    cout << a[n] + 1;
    return Accepted;
}

// Coded By OB

Compilation message

hindeks.cpp: In function 'bool isvowel(char)':
hindeks.cpp:93:13: error: redefinition of 'bool isvowel(char)'
 inline bool isvowel (char c) {
             ^~~~~~~
hindeks.cpp:22:13: note: 'bool isvowel(char)' previously defined here
 inline bool isvowel (char c) {
             ^~~~~~~
hindeks.cpp: At global scope:
hindeks.cpp:99:14: error: redefinition of 'const double eps'
 const double eps = 0.000001;
              ^~~
hindeks.cpp:28:14: note: 'const double eps' previously defined here
 const double eps = 0.000001;
              ^~~
hindeks.cpp:100:10: error: redefinition of 'const long double pi'
 const ld pi = acos(-1);
          ^~
hindeks.cpp:29:10: note: 'const long double pi' previously defined here
 const ld pi = acos(-1);
          ^~
hindeks.cpp:101:11: error: redefinition of 'const int maxn'
 const int maxn = 1e7 + 9;
           ^~~~
hindeks.cpp:30:11: note: 'const int maxn' previously defined here
 const int maxn = 1e7 + 9;
           ^~~~
hindeks.cpp:102:11: error: redefinition of 'const int mod'
 const int mod = 1e9 + 7;
           ^~~
hindeks.cpp:31:11: note: 'const int mod' previously defined here
 const int mod = 1e9 + 7;
           ^~~
hindeks.cpp:103:10: error: redefinition of 'const long long int MOD'
 const ll MOD = 1e18 + 9;
          ^~~
hindeks.cpp:32:10: note: 'const long long int MOD' previously defined here
 const ll MOD = 1e18 + 9;
          ^~~
hindeks.cpp:104:10: error: redefinition of 'const long long int INF'
 const ll INF = 1e18 + 123;
          ^~~
hindeks.cpp:33:10: note: 'const long long int INF' previously defined here
 const ll INF = 1e18 + 123;
          ^~~
hindeks.cpp:105:11: error: redefinition of 'const int inf'
 const int inf = 2e9 + 11;
           ^~~
hindeks.cpp:34:11: note: 'const int inf' previously defined here
 const int inf = 2e9 + 11;
           ^~~
hindeks.cpp:106:11: error: redefinition of 'const int mxn'
 const int mxn = 1e6 + 9;
           ^~~
hindeks.cpp:35:11: note: 'const int mxn' previously defined here
 const int mxn = 1e6 + 9;
           ^~~
hindeks.cpp:107:11: error: redefinition of 'const int N'
 const int N = 1e6 + 123;                                          
           ^
hindeks.cpp:36:11: note: 'const int N' previously defined here
 const int N = 1e6 + 123;                                          
           ^
hindeks.cpp:108:11: error: redefinition of 'const int M'
 const int M = 22;
           ^
hindeks.cpp:37:11: note: 'const int M' previously defined here
 const int M = 22;
           ^
hindeks.cpp:109:11: error: redefinition of 'const int pri'
 const int pri = 997;
           ^~~
hindeks.cpp:38:11: note: 'const int pri' previously defined here
 const int pri = 997;
           ^~~
hindeks.cpp:110:11: error: redefinition of 'const int Magic'
 const int Magic = 2101;
           ^~~~~
hindeks.cpp:39:11: note: 'const int Magic' previously defined here
 const int Magic = 2101;
           ^~~~~
hindeks.cpp:112:14: error: redefinition of 'const int dx []'
 const int dx[] = {-1, 0, 1, 0};
              ^
hindeks.cpp:41:11: note: 'const int dx [4]' previously defined here
 const int dx[] = {-1, 0, 1, 0};
           ^~
hindeks.cpp:113:14: error: redefinition of 'const int dy []'
 const int dy[] = {0, -1, 0, 1};
              ^
hindeks.cpp:42:11: note: 'const int dy [4]' previously defined here
 const int dy[] = {0, -1, 0, 1};
           ^~
hindeks.cpp:115:5: error: redefinition of 'int n'
 int n, m, k;
     ^
hindeks.cpp:44:5: note: 'int n' previously declared here
 int n, m, k;
     ^
hindeks.cpp:115:8: error: redefinition of 'int m'
 int n, m, k;
        ^
hindeks.cpp:44:8: note: 'int m' previously declared here
 int n, m, k;
        ^
hindeks.cpp:115:11: error: redefinition of 'int k'
 int n, m, k;
           ^
hindeks.cpp:44:11: note: 'int k' previously declared here
 int n, m, k;
           ^
hindeks.cpp:116:10: error: redefinition of 'int cnt [1000123]'
 int cnt[N];
          ^
hindeks.cpp:45:5: note: 'int cnt [1000123]' previously declared here
 int cnt[N];
     ^~~
hindeks.cpp:117:8: error: redefinition of 'std::__cxx11::string s'
 string s;
        ^
hindeks.cpp:46:8: note: 'std::__cxx11::string s' previously declared here
 string s;
        ^
hindeks.cpp:118:8: error: redefinition of 'int a [1000123]'
 int a[N];
        ^
hindeks.cpp:47:5: note: 'int a [1000123]' previously declared here
 int a[N];
     ^
hindeks.cpp:119:19: error: redefinition of 'std::vector<int> g [1000123]'
 vector < int > g[N];
                   ^
hindeks.cpp:48:16: note: 'std::vector<int> g [1000123]' previously declared here
 vector < int > g[N];
                ^
hindeks.cpp:120:8: error: redefinition of 'int u [1000123]'
 int u[N];
        ^
hindeks.cpp:49:5: note: 'int u [1000123]' previously declared here
 int u[N];
     ^
hindeks.cpp:121:5: error: redefinition of 'int ans'
 int ans, res;
     ^~~
hindeks.cpp:50:5: note: 'int ans' previously declared here
 int ans, res;
     ^~~
hindeks.cpp:121:10: error: redefinition of 'int res'
 int ans, res;
          ^~~
hindeks.cpp:50:10: note: 'int res' previously declared here
 int ans, res;
          ^~~
hindeks.cpp:122:5: error: redefinition of 'int cur'
 int cur;
     ^~~
hindeks.cpp:51:5: note: 'int cur' previously declared here
 int cur;
     ^~~
hindeks.cpp: In function 'int main()':
hindeks.cpp:124:5: error: redefinition of 'int main()'
 int main () {               
     ^~~~
hindeks.cpp:53:5: note: 'int main()' previously defined here
 int main () {               
     ^~~~