답안 #832714

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832714 2023-08-21T14:09:16 Z DarkMatter Baloni (COCI15_baloni) C++14
0 / 100
2000 ms 7328 KB
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int>pi;
typedef pair<ll, ll>pl;
typedef vector<pi>vpi;
typedef vector<pl>vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
const long double PI = acos(-1);
const ll oo = 1e18;
const int MOD = 1e9 + 7;
const int N = 2e5 + 7;
#define endl '\n'
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define read(v) for (auto& it : v) scanf("%d", &it);
#define readL(v) for (auto& it : v) scanf("%lld", &it);
#define print(v) for (auto it : v) printf("%d ", it); puts("");
#define printL(v) for (auto it : v) printf("%lld ", it); puts("");
void solve() {
	int n;
	scanf("%d", &n);
	vi v(n);
	read(v);
	vb vis(n, false);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (vis[i])
			continue;
		int h = v[i];
		ans++;
		for (int j = i; j < n; j++)
			if (h == v[j])
				h--, vis[j] = true;
	}
	printf("%d\n", ans);
}
int t = 1;
int main() {
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt", "r", stdin);
	//#endif
		//scanf("%d", &t);
	while (t--) solve();
}

Compilation message

baloni.cpp: In function 'void solve()':
baloni.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
baloni.cpp:24:41: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 | #define read(v) for (auto& it : v) scanf("%d", &it);
      |                                    ~~~~~^~~~~~~~~~~
baloni.cpp:32:2: note: in expansion of macro 'read'
   32 |  read(v);
      |  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Incorrect 4 ms 324 KB Output isn't correct
4 Incorrect 5 ms 336 KB Output isn't correct
5 Execution timed out 2074 ms 6960 KB Time limit exceeded
6 Execution timed out 2043 ms 7328 KB Time limit exceeded
7 Execution timed out 2069 ms 6004 KB Time limit exceeded
8 Execution timed out 2075 ms 5932 KB Time limit exceeded
9 Execution timed out 2073 ms 6468 KB Time limit exceeded
10 Execution timed out 2084 ms 6588 KB Time limit exceeded