답안 #631960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
631960 2022-08-19T08:45:11 Z Jovan26 Addk (eJOI21_addk) C++14
0 / 100
290 ms 1300 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int k;
	cin>>k;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	int q;
	cin>>q;
	vector<int> v;
	for(int j=0;j<q;j++){
		int x;
		cin>>x;
		if(x==1){
		int y;
		cin>>y;
		 continue;
		}
		int l,r,m;
		cin>>l>>r>>m;
		int rez = 0;
		for(int i=l-1;i<l+m-2;i++){
			rez+=(i-l+2)*a[i];
		}
		for(int i=r-1;i>r-m;i--){
			rez+=(r-i)*a[i];
					}
		for(int i=l+m-2;i<=r-m;i++){
			rez+=a[i]*m;
		}
		v.push_back(rez);
	}
	for(int i=0;i<v.size();i++) cout<<v[i]<<endl;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:35:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |  for(int i=0;i<v.size();i++) cout<<v[i]<<endl;
      |              ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 290 ms 1300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 1212 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -