Submission #36605926


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
 
typedef long long int lli;

//lli N = 10e6+1;
//vector <bool> arr(N, true);
//double eps = 1e-9;
 
void solve()
{
	lli n, k, i;
	cin>>n>>k;
	vector <lli> arr(n);
	for(i=0;i<n;i++) cin>>arr[i];
	for(i=0;i<k;i++) arr.push_back(0);
	for(i=k;i<arr.size();i++) cout<<arr[i]<<" "; 
}
 
void usaco()
{
	freopen("diamond.in","r",stdin);
  	freopen("diamond.out","w",stdout);
}
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
}

Submission Info

Submission Time
Task A - Shift
User Pesto
Language C++ (GCC 9.2.1)
Score 100
Code Size 524 Byte
Status AC
Exec Time 5 ms
Memory 3616 KiB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:17:11: warning: comparison of integer expressions of different signedness: ‘lli’ {aka ‘long long int’} and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   17 |  for(i=k;i<arr.size();i++) cout<<arr[i]<<" ";
      |          ~^~~~~~~~~~~
./Main.cpp: In function ‘void usaco()’:
./Main.cpp:22:9: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   22 |  freopen("diamond.in","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
./Main.cpp:23:11: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   23 |    freopen("diamond.out","w",stdout);
      |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 14
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 02_min_00.txt, 02_min_01.txt, 02_min_02.txt, 03_max_00.txt, 03_max_01.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 5 ms 3556 KiB
00_sample_01.txt AC 2 ms 3596 KiB
00_sample_02.txt AC 2 ms 3612 KiB
01_random_00.txt AC 2 ms 3484 KiB
01_random_01.txt AC 2 ms 3520 KiB
01_random_02.txt AC 2 ms 3584 KiB
01_random_03.txt AC 2 ms 3592 KiB
01_random_04.txt AC 2 ms 3612 KiB
01_random_05.txt AC 2 ms 3596 KiB
02_min_00.txt AC 2 ms 3616 KiB
02_min_01.txt AC 2 ms 3460 KiB
02_min_02.txt AC 2 ms 3504 KiB
03_max_00.txt AC 2 ms 3604 KiB
03_max_01.txt AC 3 ms 3528 KiB