답안 #168909

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168909 2019-12-17T05:38:50 Z abil Gift (IZhO18_nicegift) C++14
0 / 100
1639 ms 35348 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define all(s) s.begin(),s.end()
//#define int long long

using namespace std;

const int N = (1e6 + 12);
const int mod = (1e9 + 7);
const int INF = (0x3f3f3f3f);

int a[N];
main()
{
	int n, k;
	bool f = true;
	scanf("%lld%lld", &n, &k);
	for(int i = 1;i <= n; i++){
		scanf("%lld", &a[i]);
		if(i > 1){
			if(a[i] != a[i - 1]){
				f = false;
			}
		}
	}
	if(f){
		if(n % k == 0){
			cout << n / k << endl;
			int x = n / k, cnt = 1;
			while(x--){
				cout << a[1] << " ";
				for(int i = 1;i <= k; i++){
					cout << cnt << " ";
					cnt++;
				}
				cout << endl;
			}
		}
	}
}

Compilation message

nicegift.cpp:17:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
nicegift.cpp: In function 'int main()':
nicegift.cpp:21:26: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
  scanf("%lld%lld", &n, &k);
                    ~~    ^
nicegift.cpp:21:26: warning: format '%lld' expects argument of type 'long long int*', but argument 3 has type 'int*' [-Wformat=]
nicegift.cpp:23:22: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
   scanf("%lld", &a[i]);
                 ~~~~~^
nicegift.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &n, &k);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
nicegift.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &a[i]);
   ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1639 ms 35348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -