답안 #50333

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
50333 2018-06-10T08:04:12 Z top34051 Sterilizing Spray (JOI15_sterilizing) C++17
5 / 100
5000 ms 47380 KB
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n,q,k;
int a[maxn];
int main() {
	scanf("%d%d%d",&n,&q,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	while(q--) {
		int type; scanf("%d",&type);
		if(type==1) {
			int x,val; scanf("%d%d",&x,&val);
			a[x] = val;
		}
		else if(type==2) {
			int l,r; scanf("%d%d",&l,&r);
			for(int i=l;i<=r;i++) a[i] /= k;
		}
		else {
			int l,r; scanf("%d%d",&l,&r);
			long long sum = 0;
			for(int i=l;i<=r;i++) sum += a[i];
			printf("%lld\n",sum);
		}
	}
}

Compilation message

sterilizing.cpp: In function 'int main()':
sterilizing.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&n,&q,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~
sterilizing.cpp:8:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%d",&a[i]);
                        ~~~~~^~~~~~~~~~~~
sterilizing.cpp:10:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int type; scanf("%d",&type);
             ~~~~~^~~~~~~~~~~~
sterilizing.cpp:12:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    int x,val; scanf("%d%d",&x,&val);
               ~~~~~^~~~~~~~~~~~~~~~
sterilizing.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    int l,r; scanf("%d%d",&l,&r);
             ~~~~~^~~~~~~~~~~~~~
sterilizing.cpp:20:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    int l,r; scanf("%d%d",&l,&r);
             ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 3 ms 404 KB Output is correct
3 Correct 3 ms 656 KB Output is correct
4 Correct 5 ms 884 KB Output is correct
5 Correct 7 ms 884 KB Output is correct
6 Correct 7 ms 884 KB Output is correct
7 Correct 8 ms 940 KB Output is correct
8 Correct 7 ms 1056 KB Output is correct
9 Correct 7 ms 1076 KB Output is correct
10 Correct 9 ms 1144 KB Output is correct
11 Correct 7 ms 1212 KB Output is correct
12 Correct 8 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1850 ms 4064 KB Output is correct
2 Correct 1135 ms 5624 KB Output is correct
3 Correct 1791 ms 7284 KB Output is correct
4 Correct 2830 ms 9584 KB Output is correct
5 Correct 3838 ms 12064 KB Output is correct
6 Correct 3666 ms 14640 KB Output is correct
7 Correct 3618 ms 17092 KB Output is correct
8 Correct 3723 ms 19692 KB Output is correct
9 Execution timed out 5031 ms 20876 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 115 ms 20876 KB Output is correct
2 Correct 258 ms 21124 KB Output is correct
3 Correct 426 ms 21488 KB Output is correct
4 Correct 895 ms 22832 KB Output is correct
5 Correct 3790 ms 24504 KB Output is correct
6 Correct 3645 ms 26052 KB Output is correct
7 Correct 3738 ms 27656 KB Output is correct
8 Correct 3598 ms 28916 KB Output is correct
9 Execution timed out 5028 ms 29456 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1313 ms 31120 KB Output is correct
2 Correct 1576 ms 32892 KB Output is correct
3 Correct 830 ms 33804 KB Output is correct
4 Correct 1159 ms 35740 KB Output is correct
5 Correct 3696 ms 38364 KB Output is correct
6 Correct 3663 ms 40716 KB Output is correct
7 Correct 3599 ms 43372 KB Output is correct
8 Correct 3582 ms 45952 KB Output is correct
9 Execution timed out 5051 ms 47380 KB Time limit exceeded
10 Halted 0 ms 0 KB -