답안 #72417

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72417 2018-08-26T07:58:13 Z 인프라웨어 상한가 가주세요. 물렸어요(#2188, c4big, cepiloth) 박스런 (FXCUP3_box) C++17
17 / 100
1000 ms 736 KB
#include <vector>
#include <iostream>

using namespace std;

int main() {
	int N; cin >> N;
	vector<long long> arr(N + 1);
	for (int i = 1; i <= N; ++i) cin >> arr[i];

	vector<int> sol;
	for (int i = 1; i <= N; ++i) {	// �ʺ�
		int lessCnt = 0;
		int here = arr[1];	// �������
		bool hasSol = false;
		for (int j = i + 1; j <= N; ++j) {
			int lessCnt = 0;
			for (int k = j - 1; k >= j - i; --k) {
				if (arr[j] > arr[k])
					lessCnt++;
			}
			if (lessCnt == i) {
				int sub = i - 1;
				sol.push_back(j - 1 - sub);
				hasSol = true;
				break;
			}
		}
		if (hasSol == false)
			sol.push_back(-1);
		
	}
	for (int i = 0; i < sol.size(); ++i)
		cout << sol[i] << " ";
	return 0;
}


Compilation message

box.cpp: In function 'int main()':
box.cpp:13:7: warning: unused variable 'lessCnt' [-Wunused-variable]
   int lessCnt = 0;
       ^~~~~~~
box.cpp:14:7: warning: unused variable 'here' [-Wunused-variable]
   int here = arr[1]; // 
       ^~~~
box.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < sol.size(); ++i)
                  ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 356 KB Output is correct
4 Correct 3 ms 392 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
7 Correct 2 ms 516 KB Output is correct
8 Correct 2 ms 516 KB Output is correct
9 Correct 2 ms 536 KB Output is correct
10 Correct 2 ms 536 KB Output is correct
11 Correct 3 ms 536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 356 KB Output is correct
4 Correct 3 ms 392 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
7 Correct 2 ms 516 KB Output is correct
8 Correct 2 ms 516 KB Output is correct
9 Correct 2 ms 536 KB Output is correct
10 Correct 2 ms 536 KB Output is correct
11 Correct 3 ms 536 KB Output is correct
12 Correct 119 ms 592 KB Output is correct
13 Execution timed out 1085 ms 736 KB Time limit exceeded
14 Halted 0 ms 0 KB -