답안 #1099774

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099774 2024-10-12T05:14:44 Z model_code 나일강 (IOI24_nile) C++17
17 / 100
2000 ms 5128 KB
// incorrect/bakry_minpack_q1.cpp

#include <bits/stdc++.h>

using namespace std ;

vector<long long>calculate_costs(vector<int>W, vector<int>A, vector<int>B, vector<int>E) {
	vector< array<int , 3> >ord;
	int n = W.size(), q = E.size();
	for(int i = 0; i < n; ++i)
		ord.push_back({W[i], A[i], B[i]});
	sort(ord.begin(), ord.end());
	for(int i = 0; i < n; ++i)
		W[i] = ord[i][0], A[i] = ord[i][1], B[i] = ord[i][2];
	W.push_back(2e9 + 100);
	vector<long long>v;
	for(int curq = 0; curq < E.size(); ++curq)
	{
		int d = E[curq];
		long long ans = 0;
		int cnt = 0;
		for(int i = 0; i < n; ++i) {
			ans += A[i], cnt++;
			if(W[i+1] - W[i] > d)
				ans = ans - cnt + (cnt&1), cnt = 0;
		}
		v.push_back(ans);
	}
	return v;
}

Compilation message

nile.cpp: In function 'std::vector<long long int> calculate_costs(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
nile.cpp:17:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for(int curq = 0; curq < E.size(); ++curq)
      |                    ~~~~~^~~~~~~~~~
nile.cpp:9:20: warning: unused variable 'q' [-Wunused-variable]
    9 |  int n = W.size(), q = E.size();
      |                    ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 4304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 4312 KB Output is correct
2 Correct 28 ms 4308 KB Output is correct
3 Correct 29 ms 4300 KB Output is correct
4 Correct 34 ms 4308 KB Output is correct
5 Correct 29 ms 4308 KB Output is correct
6 Correct 26 ms 4292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 4312 KB Output is correct
2 Correct 28 ms 4308 KB Output is correct
3 Correct 29 ms 4300 KB Output is correct
4 Correct 34 ms 4308 KB Output is correct
5 Correct 29 ms 4308 KB Output is correct
6 Correct 26 ms 4292 KB Output is correct
7 Execution timed out 2057 ms 5128 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -