submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s628260369 | p02262 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int n, a[1100000], cnt, g[20];
int main() {
cin >> n;
for(int i = 0; i < n; i++) scanf("%d", &a[i]);
g[0] = 1; cnt = 0;
while(true) {
g[cnt + 1] = g[cnt] * 3 + 1;
if(g[++cnt] >= n) break;
}
int ret = 0;
for(int i = cnt - 1; i >= 0; i--) {
for(in... | a.cc: In function 'int main()':
a.cc:26:21: error: 'c' was not declared in this scope
26 | for(int i = c - 1; i >= 0; i--) printf(i ? "%d " : "%d\n", g[i]);
| ^
|
s777700876 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;
void insertionSort(int A[], int n, int g) {
for ( int i = g; i < n; i++ ) {
int v = A[i];
int j = i - g;
while( j >= 0 ... | a.cc: In function 'void shellSort(int*, int)':
a.cc:31:11: error: 'class std::vector<int>' has no member named 'push_pack'; did you mean 'push_back'?
31 | G.push_pack(h);
| ^~~~~~~~~
| push_back
|
s511993211 | p02262 | C++ | #include<stdio.h>
#include <sstream>
#include <iostream>
#include <cstdlib>
#include <string.h>
using namespace std;
#define BUF_SIZE 1024
int count = 0;
void insertionSort(int array[],int n,int g)
{
int v,j;
for(int i=g;i<n;i++){
v=array[i];
j=i-g;
while(j>=0&&array[j].v){
array[j+g]=array... | a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:19:26: error: request for member 'v' in '*(array + ((sizetype)(((long unsigned int)j) * 4)))', which is of non-class type 'int'
19 | while(j>=0&&array[j].v){
| ^
a.cc: At global scope:
a.cc:59:1: error: expected declarati... |
s120515160 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int>G;
//間隔Gを指定した挿入ソート
void insertSort(int A[], int n, int g) {
for (int i = g;i < n;i++) {
int v = A[i];
int j = i - g;
while (j >= 0 && A[j] > v) {
... | a.cc: In function 'void insertSort(int*, int, int)':
a.cc:24:11: error: 'j' was not declared in this scope
24 | A[j + g] = v;
| ^
a.cc:24:20: error: 'v' was not declared in this scope
24 | A[j + g] = v;
| ^
a.cc: In function 'void ShellSort(int*, int)':
a.c... |
s502550635 | p02262 | C++ | #include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
// unsigned int e[101];
// unsigned int d[101];
char e[101][2];
char d[101][2];
unsigned int cnt = 0;
void insertsort(unsigned int *d, unsigned int n, unsigned int g)
{
for (unsigned int i = g; i < n; ++i) {
unsign... | a.cc: In function 'int main()':
a.cc:54:9: error: 'vector' was not declared in this scope
54 | vector<unsigned int> s;
| ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
4 | #include <algorithm>
+++ |+#include <ve... |
s948123454 | p02262 | C++ | #include <iostream>
#include <vector>
using namespace std;
// unsigned int e[101];
// unsigned int d[101];
char e[101][2];
char d[101][2];
unsigned int cnt = 0;
void insertsort(unsigned int *d, unsigned int n, unsigned int g)
{
for (unsigned int i = g; i < n; ++i) {
unsigned int v = d[i];
int j = i - g;
whil... | a.cc: In function 'int main()':
a.cc:64:19: error: 'i' was not declared in this scope
64 | cout << s[i] << endl;
| ^
|
s839624091 | p02262 | C++ | #include<iostream>
#include<cmath>
using namespace std;
#include<vector>
#define ArrayNum 100
vector<int> g;
int insertionSort(int a[],int n,int g){
int i,j,cnt=0,v;
for(i=g;i<n;i++){
v= a[i];
j=i-g;
while(j>=0 && a[j]>v){
a[j+g]=a[j];
j=j-g;
cnt++;
}
a[j+g]=v;
}
return... | a.cc: In function 'void shellSort(int*, int)':
a.cc:41:11: error: 'c' was not declared in this scope
41 | cout << c[m-1] << "\n";
| ^
|
s422333708 | p02262 | C++ | #include <iostream>
#include <vector>
using namespace std;
int m;
vector<int> G;
int insertionSort(int A[], int n, int g){
int cnt = 0;
for(int i=g; i<n; ++i){
int v = A[i];
int j = i - g;
while(j>=0 && A[j]>v){
A[j+g] = A[j];
j -= g;
cnt++;
}
... | a.cc: In function 'int shellSort(int*, int)':
a.cc:29:5: error: 'reverse' was not declared in this scope
29 | reverse(G.begin(), G.end());
| ^~~~~~~
|
s559393083 | p02262 | C++ | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#includ... | a.cc: In function 'void insertionSort(std::vector<int>&, int, int)':
a.cc:197:32: error: 'v' was not declared in this scope
197 | while( j >= 0 and A[j] > v )
| ^
|
s928897947 | p02262 | C++ | #include <bits/stdc++.h>
using namespace std;
long insertionSort(vector<long>& A, int n, int g)
{
long cnt = 0;
for(int i = g; i < n; i++){
int v = A.at(i);
int j = i - g;
while(j >= 0 && A.at(j) > v){
A.at(j+g) = A.at(j);
j = j - g;
cnt++;
}
A.at(j+g) = v;
}
return cnt;
}
long s... | a.cc: In function 'int main()':
a.cc:65:10: error: expected unqualified-id before '=' token
65 | long = shellSort(A, N, m, G);
| ^
|
s500637633 | p02262 | C++ | #include<iostream>
using namespace std;
static int cnt = 0;
void insertionSort(int A[], int n, int g) {
int v, i, j;
for (i=g; i<n; i++) {
v = A[i];
j = i-g;
while (j>=0 && A[j]>v) {
A[j+g] = A[j];
j = j-g;
cnt++;
}
A[j+g]=v;
}
}
... | a.cc: In function 'void print(int, int*, int*, int)':
a.cc:32:32: error: a function-definition is not allowed here before '{' token
32 | void shellSort(int A[], int n) {
| ^
a.cc:52:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
52 ... |
s326166173 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;
// 間隔gを指定した挿入ソート
void insertionSort(int A[], int n, int g) {
for ( int i = g; i < n; i++ ) {
int v = A[i];
int j = i - g;
... | a.cc: In function 'int main()':
a.cc:59:1: error: expected primary-expression before '}' token
59 | }
| ^
a.cc:58:11: error: expected ';' before '}' token
58 | return
| ^
| ;
59 | }
| ~
|
s915707057 | p02262 | C++ | #include <iostream>
#include <iomanip>
#include <math.h>
#include <fstream>
#include <string>
#include <time.h>
#include <ctime>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <cstdlib>
using namespace std;
int cnt... | a.cc: In function 'void shellSort(int*, int)':
a.cc:40:13: error: declaration of 'int n' shadows a parameter
40 | int n=1000000;
| ^
a.cc:38:28: note: 'int n' previously declared here
38 | void shellSort(int A[],int n){
| ~~~~^
|
s623372819 | p02262 | C++ | /*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D&lang=jp*/
#include <iostream>
#include <algorithm>
using namespace std;
void insertionSort(int *a,int n,int g,int *cnt){
for(int i=g;i<n;i++){
int v=a[i];
int j=i-g;
while(-1<j && v<a[j]){
a[j+g]=a[j];
... | a.cc: In function 'void shellSort(int*, int)':
a.cc:22:5: error: 'vector' was not declared in this scope
22 | vector<int> g(1,1);
| ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
3 | #include <algorithm>
+++ |+#include ... |
s660676751 | p02262 | C++ | using System;
namespace ALDS1_2_D
{
class Program
{
static void Main(string[] args)
{
string str = Console.ReadLine();
int n = int.Parse(str);
int[] A = new int[n];
for (int i = 0; i < n; ++i)
{
str = Console.ReadLine(... | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:7:26: error: 'string' has not been declared
7 | static void Main(string[] args)
| ^~~~~~
a.cc:7:35: error: expected ',' or '...' before 'args'
7 | static... |
s607495554 | p02262 | C++ | using System;
namespace ALDS1_2_D
{
class Program
{
static void Main(string[] args)
{
string str = Console.ReadLine();
int n = int.Parse(str);
int[] A = new int[n];
for (int i = 0; i < n; ++i)
{
str = Console.ReadLine(... | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:7:26: error: 'string' has not been declared
7 | static void Main(string[] args)
| ^~~~~~
a.cc:7:35: error: expected ',' or '...' before 'args'
7 | static... |
s570033169 | p02262 | C++ | #include<iostream>
#include<vector>
using namespace std;
int cnt = 0;
void insertionSort( vector<int> &elems, int n, int g )
{
int i, j, v;
for( i=0; i<n; i++ ) {
v = elems[i];
j = i - g;
while( 0 <= j and v < elems[j] ) {
elems[ j+g ] = elems[j];
j -= g;
cnt++;
}
elems[ j+g ] = v;
}
return;
}
... | a.cc: In function 'void shellSort(std::vector<int>&, int)':
a.cc:40:9: error: 'sort' was not declared in this scope; did you mean 'short'?
40 | sort( G.rbegin( ), G.rend( ) );
| ^~~~
| short
|
s568837281 | p02262 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;
void insertionSort(int A[], int n, int g){
for( int i = g; i < n; i++){
int v = A[i];
int j = i - g;
while( j >= 0 && A[j] > v ){
A[j... | a.cc: In function 'int main()':
a.cc:42:16: error: expected ';' before 'shellSort'
42 | cnt = 0
| ^
| ;
43 |
44 | shellSort(A, n);
| ~~~~~~~~~
|
s539689649 | p02262 | C++ | 23
933
743
262
529
700
508
752
256
256
119
711
351
843
705
108
393
330
366
169
932
917
847
972 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 23
| ^~
|
s254670922 | p02262 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using mamespace std;
long long cnt;
int l;
int A[10000000];
int n;
vector<int> G;
void insert(int A[],int n,int g){
int i,j,v,cnt=0;
for(i=g;i<n-1;i++){
v=A[i];
j=i-g;
while(j>=0 && A[j]>v){
A[j+g]=A[j];
j=j-g;
cnt++:
}
... | a.cc:4:7: error: expected nested-name-specifier before 'mamespace'
4 | using mamespace std;
| ^~~~~~~~~
a.cc:10:1: error: 'vector' does not name a type
10 | vector<int> G;
| ^~~~~~
a.cc: In function 'void insert(int*, int, int)':
a.cc:20:12: error: expected ';' before ':' token
20 | cn... |
s167864359 | p02262 | C++ | #include <iostream>
#include <algorithm>
std::vector<unsigned> gaps;
unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap = 1){
unsigned count = 0;
for(unsigned i = gap; i < n; i++){
unsigned v = a[i];
int j = i - gap;
while(j >= 0 && a[j] > v){
a[j+gap] = a[j];
j -= gap;
c... | a.cc:4:6: error: 'vector' in namespace 'std' does not name a template type
4 | std::vector<unsigned> gaps;
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <algorithm>
+++ |+#include <vector>
3 |
a.cc: I... |
s718657797 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;
// ??????g ????????????????????\?????????
void insertionSort(int A[], int n, intg) {
for ( int i = g; i < n; i++ ) {
int v = A[i];
int j =... | a.cc:15:36: error: 'intg' has not been declared
15 | void insertionSort(int A[], int n, intg) {
| ^~~~
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:16:17: error: 'g' was not declared in this scope
16 | for ( int i = g; i < n; i++ ) {
| ... |
s763278980 | p02262 | C++ | #include <stdio.h>
#include <stdlib.h>
unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913};
// generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)
unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap){
unsigned count = 0;
for(unsigned i = gap; i < n; i++){
unsigned v = a[i];
int ... | a.cc: In function 'int main()':
a.cc:41:23: error: invalid conversion from 'void*' to 'unsigned int*' [-fpermissive]
41 | unsigned* a = malloc(sizeof(unsigned)*n);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~
| |
| void*
|
s228783133 | p02262 | C++ |
#include <utility>
using namespace std;
#define ELEMENT_MAX 1000000
int elements[ELEMENT_MAX];
void output(int n, int elements[])
{
for (int i = 0; i < n; i++)
cout << elements[i] << endl;
}
int insertion_sort(int n, int elements[], int g)
{
int cnt = 0;
for (int i = g; i < n; i++) {
int key = elements[i],... | a.cc: In function 'void output(int, int*)':
a.cc:13:17: error: 'cout' was not declared in this scope
13 | cout << elements[i] << endl;
| ^~~~
a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include ... |
s782302031 | p02262 | C++ | #include <iostream>
#include <utility>
using namespace std;
#define ELEMENT_MAX 1000000
int elements[ELEMENT_MAX];
void output(int n)
{
for (int i = 0; i < n; i++)
cout << elements[i] << endl;
}
int insertion_sort(int n, int g)
{
int cnt = 0;
for (int i = g; i < n; i++) {
int key = elements[i],
j = i - g... | a.cc:59:2: error: expected declaration before '}' token
59 | }}
| ^
|
s637208331 | p02262 | C++ | #include <iostream>
#include <vector>
using namespace std;
int cnt;
int l;
int A[100000];
vector<int> G;
void insertionSort(int A[],n,g){
for (int i = g; i < n-1 ; ++i) {
int v = A[i];
int j = i-g;
while (j >= 0 && A[j] > v ){
A[j+g] = A[j];
j = j-g;
cn... | a.cc:11:28: error: 'n' has not been declared
11 | void insertionSort(int A[],n,g){
| ^
a.cc:11:30: error: 'g' has not been declared
11 | void insertionSort(int A[],n,g){
| ^
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:12:18: erro... |
s860803181 | p02262 | C++ | #include <iostream>
#include <vector>
using namespace std;
int cnt;
int n;
int l;
int A[100000];
vector<int> G;
void insertionSort(int A[],n,g){
for (int i = g; i < n-1 ; ++i) {
int v = A[i];
int j = i-g;
while (j >= 0 && A[j] > v ){
A[j+g] = A[j];
j = j-g;
... | a.cc:12:28: error: 'n' is not a type
12 | void insertionSort(int A[],n,g){
| ^
a.cc:12:30: error: 'g' has not been declared
12 | void insertionSort(int A[],n,g){
| ^
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:13:18: error: 'g' w... |
s660814664 | p02262 | C++ | #include <iostream>
#include <vector>
using namespace std;
int cnt;
int n;
int l;
int A[100000];
vector<int> G;
void insertionSort(int A[],int n, int g){
for (int i = g; i < n-1 ; ++i) {
int v = A[i];
int j = i-g;
while (j >= 0 && A[j] > v ){
A[j+g] = A[j];
j = j-g... | a.cc: In function 'int main()':
a.cc:53:17: error: 'a' was not declared in this scope
53 | cout << a[i] << endl;
| ^
|
s067610191 | p02262 | C++ | #include <iostream>
#include <vector>
using namespace std;
int cnt;
int n;
int l;
int A[1000000];
vector<int> G;
void insertionSort(int A[],int n, int g){
for (int i = g; i < n-1 ; ++i) {
int v = A[i];
int j = i-g;
while (j >= 0 && A[j] > v ){
A[j+g] = A[j];
j = j-... | a.cc: In function 'int main()':
a.cc:51:17: error: 'a' was not declared in this scope
51 | cout << a[i] << endl;
| ^
|
s594645925 | p02262 | C++ | #include <iostream>
#include<cmath>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
int cnt;
int n;
int l;
int A[1000000];
vector<int> G;
void insertionSort(int A[],int n, int g){
for (int i = g; i < n-1 ; ++i) {
int v = A[i];
int j = i-g;
while (j >= 0 && A[j]... | a.cc: In function 'int main()':
a.cc:53:17: error: 'a' was not declared in this scope
53 | cout << a[i] << endl;
| ^
|
s549167405 | p02262 | C++ | #include<iostream>
using namespace std;
long long pow(int x, int n){ //x^n
if (n==0)
return 1;
else
return x * pow(x, n-1);
}
void show(int arr[], int N){
for(int i=0; i<N; i++)
if(i<N-1)
cout<<arr[i]<<' '<<flush;
else
cout<<arr[i]<<flush;
cout<<endl;
}
void swap(int& a, int& b){
int t=a;
a=b;
... | a.cc: In function 'int InsertionSort_r(int*, int, int)':
a.cc:88:34: error: expected primary-expression before ';' token
88 | for( int i=0; i<range && ; i++) {
| ^
a.cc:91:62: error: 'conpindex' was not declared in this scope; did you mean 'compindex'?
91 | ... |
s049440169 | p02262 | C++ | #include<iostream>
#include<vector>
using namespace std;
void show(int arr[], int N){
for(int i=0; i<N; i++)
if(i<N-1)
cout<<arr[i]<<' '<<flush;
else
cout<<arr[i]<<flush;
cout<<endl;
}
void swap(int& a, int& b){
int t=a;
a=b;
b=t;
}
int ShellSort(int* arr, int N);
int InsertionSort_r(int* arr, int N... | a.cc:123:1: error: unterminated comment
123 | /* ?§£??????????????????????????????
| ^
|
s134526563 | p02262 | C++ | int cnt;
void insertionSort(int A[], int n, int g)
{
for (int i = g; i < n; i++) {
int v = A[i];
int j = i - g;
while (j >= 0 && A[j] > v) {
A[j + g] = A[j];
j -= g;
cnt++;
}
A[j + g] = v;
}
}
void shellSort(int A[], int n)
{
cnt = 0;
int m = n > 2 ? n / 2 : n;
int G[100];
G[0] = 1;
for (i... | a.cc: In function 'void shellSort(int*, int)':
a.cc:27:9: error: 'cout' was not declared in this scope
27 | cout << m << "\n";
| ^~~~
a.cc: In function 'int main()':
a.cc:41:9: error: 'cin' was not declared in this scope
41 | cin >> n;
| ^~~
a.cc:47:9: error: 'cout' was... |
s094088715 | p02262 | C++ | using System;
using System.Collections.Generic;
public class ShellSort
{
public int cnt = 0;
// ?????§???????????????????????¢?????´?????????
public void sort (int[] T, int n)
{
//int[] G = new int[m];
List<int> G = new List<int>();
// G????¨????
for (int i = 0; i < n; i++) {
if (i == 0) {
... | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class ShellSor... |
s537285827 | p02262 | C++ | #include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef vector<int> List;
int InsertionSort(List& A, int n, int g);
void ShellSort(List& A, int n);
List GetG(int n);
void OutputG(List G);
void Output(List A);
int InsertionSort(List& A, int n, int g)
{
int count = 0;
for(int i = g... | a.cc: In function 'List GetG(int)':
a.cc:49:5: error: 'reverse' was not declared in this scope
49 | reverse(G.begin(), G.end());
| ^~~~~~~
|
s478153312 | p02262 | C++ | #include <iostream>
#include <vector>
using namespace std;
typedef vector<int> List;
int InsertionSort(List& A, int n, int g);
void ShellSort(List& A, int n);
List GetG(int n);
void OutputG(List G);
void Output(List A);
int InsertionSort(List& A, int n, int g)
{
int count = 0;
for(int i = g; i < n; i++){
... | a.cc: In function 'List GetG(int)':
a.cc:48:5: error: 'reverse' was not declared in this scope
48 | reverse(G.begin(), G.end());
| ^~~~~~~
|
s929474730 | p02262 | C++ | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int InsertionSort(vector<int>& A, int n, int g);
void ShellSort(vector<int>& A, int n);
vector<int> GetG(int n);
void OutputG(vector<int> G);
void Output(vector<int> A);
int InsertionSort(vector<int>& A, int n, int g)
{
int count = 0;
... | a.cc: In function 'std::vector<int> GetG(int)':
a.cc:47:5: error: 'reverse' was not declared in this scope
47 | reverse(G.begin(), G.end());
| ^~~~~~~
|
s373537837 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
int tst_count;
void inserSort(int A[], int n, int g){
if (g > n) return;
for (int i = g; i < n; i++) {
v = A[i];
j = i - g;
while (j >= 0 && A[j] < v) {
A[j + g] = A[j];
... | a.cc: In function 'void inserSort(int*, int, int)':
a.cc:13:9: error: 'v' was not declared in this scope
13 | v = A[i];
| ^
a.cc:14:9: error: 'j' was not declared in this scope
14 | j = i - g;
| ^
a.cc: In function 'void shell(int*, int)':
a.cc:26:5: error: 'm' was not ... |
s472062583 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
int tst_count;
void inserSort(int A[], int n, int g){
if (g > n) return;
for (int i = g; i < n; i++) {
int v = A[i];
int j = i - g;
while (j >= 0 && A[j] > v) {
A[j + g] = A[j];
... | a.cc: In function 'void shell(int*, int)':
a.cc:27:39: error: too many initializers for 'int [6]'
27 | int G[6] = {1,4,13,40,121,364,1093};
| ^
|
s464430466 | p02262 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int n, a[1111111], c, g[20];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n;
for(int i = 0; i < n; i++) {
cin >> a[i];
}
g[0] = 1; c = 1;
while(true) {
g[c + 1] = g[c] * 3 + 1;
if(g[c + 1] >= n) break;
c++;
}
int ret = 0;
fo... | a.cc: In function 'int main()':
a.cc:27:26: error: invalid types 'int [1111111][int*]' for array subscript
27 | a[w + g] = v;
| ^
|
s442937311 | p02262 | C++ | #include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int ShellSort(int elem[], int num)
{
int i, j, k;
int h;
long long target;
long long cnt = 0;
vector<long long> vect;
for (i = 0; i < num; i++) {
h = 3 * i + 1;
if (h <= num) {
vect.push_ba... | a.cc: In function 'int main()':
a.cc:63:21: error: cannot convert 'long long int*' to 'int*'
63 | cnt = ShellSort(elem, num);
| ^~~~
| |
| long long int*
a.cc:6:19: note: initializing argument 1 of 'int ShellSort(int*, int)'
6 | ... |
s063331274 | p02262 | C++ | ??????????????? | a.cc:1:1: error: expected unqualified-id before '?' token
1 | ???????????????
| ^
|
s283647160 | p02262 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
typedef long long int64;
int data[1111111];
int n;
int64 cnt = 0;
int Insertion_sort(int g);
int main(){
cin >> n;
int i,j;
int m = 0;
int g[101] = { 0 };
for(i = 0;i < n;i++){
scanf("%d",&data[i]);
}
for(i = 1;i <= n;i = i * 3 + 1)m++;
... | a.cc: In function 'int main()':
a.cc:19:17: error: reference to 'data' is ambiguous
19 | scanf("%d",&data[i]);
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_b... |
s342047339 | p02262 | C++ | #include<stdio.h>
#include<math.h>
int A[1000000],n,cnt=0;
void insertionSort(int A[],int g){
int i,j;
int v;
for(i=g;i<n;i++){
v = A[i];
j = i - g;
while(j >= 0 && A[j] > v){
A[j+g] = A[j];
j -= g;
cnt++;
A[j+g] = v;
}
}
}
main(){
int i;
int m;
double prem;
int ... | a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
19 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:25:25: error: expected ';' before 'printf'
25 | m = floor(log2(n*1.0))
| ^
| ;
26 | printf("%d\n"... |
s203573106 | p02262 | C++ | #include<stdio.h>
#include<math.h>
int A[1000000],n,cnt=0;
void insertionSort(int A[],int g){
int i,j;
int v;
for(i=g;i<n;i++){
v = A[i];
j = i - g;
while(j >= 0 && A[j] > v){
A[j+g] = A[j];
j -= g;
cnt++;
A[j+g] = v;
}
}
}
main(){
int i;
int m;
double prem;
int ... | a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
19 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:40:21: error: expected primary-expression before ']' token
40 | insertionSort(A[],G[i]);
| ^
|
s585048827 | p02262 | C++ | #include <iostream>
#include <memory>
#include <cmath>
constexpr int max_size()
{
return static_cast<int>(1e+6);
}
int insert(int* a, const int i, const int gear)
{
if (i < gear) {
return 0;
}
if (a[i - gear] <= a[i]) {
return 0;
}
std::swap(a[i - gear], a[i]);
return 1 +... | a.cc: In function 'int main()':
a.cc:80:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
80 | scanf_s("%d", &r[i]);
| ^~~~~~~
| scanf
|
s817272237 | p02262 | C++ | #include <stdio.h>
#include <iostream>
#include <memory>
#include <cmath>
constexpr int max_size()
{
return static_cast<int>(1e+6);
}
int insert(int* a, const int i, const int gear)
{
if (i < gear) {
return 0;
}
if (a[i - gear] <= a[i]) {
return 0;
}
std::swap(a[i - gear], a[... | a.cc: In function 'int main()':
a.cc:81:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
81 | scanf_s("%d", &r[i]);
| ^~~~~~~
| scanf
|
s774896977 | p02262 | C++ | n = int(input())
A = []
for i in range(0, n):
A.append(int(input()))
cnt = 0
def insertion_sort(L, n, g):
global cnt
for i in range(g, n):
v = L[i]
j = i - g
while 0 <= j and v < L[j]:
L[j+g] = L[j]
j -= g
cnt += 1
L[j+g] = v
def shell_... | a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s053269830 | p02262 | C++ | import sys
n = int(input())
A = list(map(int, sys.stdin))
cnt = 0
def insertion_sort(L, n, g):
global cnt
for i in range(g, n):
v = L[i]
j = i - g
while 0 <= j and v < L[j]:
L[j+g] = L[j]
j -= g
cnt += 1
L[j+g] = v
def shell_sort(L, n):
... | a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s577565676 | p02262 | C++ | #include <bits/stdc++.h>
using namespace std;
int N, A[100], cnt;
void Out(const vector<int> G) {
cout << G.size() << endl;
cout << G[0];
for (int i = 1; i < G.size(); i++) {
cout << ' ' << G[i];
}
cout << endl;
cout << cnt << endl;
for (int i = 0; i < N; i++)
cout << A[i] << endl;
}
void InsertionSort(int... | a.cc: In function 'void InsertionSort(int)':
a.cc:26:20: error: too few arguments to function 'void Out(std::vector<int>)'
26 | Out();
| ~~~^~
a.cc:5:6: note: declared here
5 | void Out(const vector<int> G) {
| ^~~
a.cc: In function 'int main()':
a.cc:43:12: error... |
s825409346 | p02262 | C++ | #include <bits/stdc++.h>
using namespace std;
int N, A[100], cnt;
void Out(const vector<int> G) {
cout << G.size() << endl;
cout << G[0];
for (int i = 1; i < G.size(); i++) {
cout << ' ' << G[i];
}
cout << endl;
cout << cnt << endl;
for (int i = 0; i < N; i++)
cout << A[i] << endl;
}
void InsertionSort(int... | a.cc: In function 'void InsertionSort(int)':
a.cc:26:20: error: too few arguments to function 'void Out(std::vector<int>)'
26 | Out();
| ~~~^~
a.cc:5:6: note: declared here
5 | void Out(const vector<int> G) {
| ^~~
|
s012266813 | p02262 | C++ | #include<stdio.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l,n;
int A[1000000];
vector<int> G;
void insertion(int A[], int n,int g){
int i,V,j;
for ( i = g; i < n; i++ ){
V=A[i];
j=i-1;
while (j>=0 && A[j]>V){
A[j+1]... | a.cc: In function 'void shellsort(int*, int)':
a.cc:30:7: error: 'i' was not declared in this scope
30 | for(i=1;;){
| ^
a.cc:31:6: error: 'h' was not declared in this scope
31 | if(h>n) break;
| ^
a.cc:32:15: error: 'h' was not declared in this scope
32 | G.push_back(h);
| ... |
s345400130 | p02262 | C++ | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
size_t isort(vector<int> &A, size_t g) {
size_t count_=0;
for (size_t i=g; i<A.size(); ++i) {
int v=A[i], j;
for (j=i-g; j>=0&&v<A[j]; j-=g) {
A[j+g] = A[j];
++count_;
}
A[j+g]... | a.cc: In function 'size_t shsort(std::vector<int>&)':
a.cc:22:25: error: no matching function for call to 'min(long long unsigned int, std::vector<int>::size_type)'
22 | vector<size_t> g(min(100uLL, A.size()-1));
| ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algor... |
s460379313 | p02262 | C++ | #include <bits/stdc++.h>
vector<int> G;
void insertionSort(int a[], const int n, int g, int* cnt){
int i,v,j;
for(i = g; i < n-1; i++){
v = a[i];
j = i - g;
while(j >= 0 && a[j] > v){
a[j+g] = a[j];
j = j -g;
*cnt++;
}
a[j+g] = v;
}
}
void shellSort(int a[], int n, int* cn... | a.cc:3:1: error: 'vector' does not name a type
3 | vector<int> G;
| ^~~~~~
a.cc: In function 'void shellSort(int*, int, int*)':
a.cc:21:5: error: 'G' was not declared in this scope
21 | G.push_back(h);
| ^
a.cc:25:15: error: 'G' was not declared in this scope
25 | for(int i = G.size()-1;... |
s682378828 | p02262 | C++ | /**************
* Shell Sort
*************/
#include <iostream>
#include <vector> //??£?¨?
using namespace std;
void insertionSort(vector<int>* A, int g, int* cnt ){
for(unsigned int i=g ; i<(A->size()); i++){
int v = (*A)[i];
int j = i-g;
while(j>=0 && (*A)[j]>v){
(*A)[j+g] = (*A)[j];
j = j-g;
(*cn... | a.cc: In function 'int main()':
a.cc:51:9: error: 'reverse' was not declared in this scope
51 | reverse(G.begin(), G.end());
| ^~~~~~~
|
s092789025 | p02262 | C++ | /**************
* Shell Sort
*************/
#include <iostream>
#include <vector> //??£?¨?
using namespace std;
void insertionSort(vector<int>* A, int g, int* cnt ){
for(unsigned int i=g ; i<(A->size()); i++){
int v = (*A)[i];
int j = i-g;
while(j>=0 && (*A)[j]>v){
(*A)[j+g] = (*A)[j];
j = j-g;
(*cn... | a.cc: In function 'int main()':
a.cc:52:9: error: 'reverse' was not declared in this scope
52 | reverse(G.begin(), G.end());
| ^~~~~~~
|
s242404033 | p02262 | C++ | /**************
* Shell Sort
*************/
#include <iostream>
#include <vector> //??£?¨?
#include <argolithm>
using namespace std;
void insertionSort(vector<int>* A, int g, int* cnt ){
for(unsigned int i=g ; i<(A->size()); i++){
int v = (*A)[i];
int j = i-g;
while(j>=0 && (*A)[j]>v){
(*A)[j+g] = (*A)[j]... | a.cc:7:10: fatal error: argolithm: No such file or directory
7 | #include <argolithm>
| ^~~~~~~~~~~
compilation terminated.
|
s431174192 | p02262 | C++ | /**************
* Shell Sort
*************/
#include <iostream>
#include <vector> //??£?¨?
#include <algorithm>
using namespace std;
void insertionSort(vector<int>* A, int g, int* cnt ){
for(unsigned int i=g ; i<(A->size()); i++){
int v = (*A)[i];
int j = i-g;
while(j>=0 && (*A)[j]>v){
(*A)[j+g] = (*A)[j]... | a.cc: In function 'int main()':
a.cc:37:9: error: 'sync_with_stdio' was not declared in this scope
37 | sync_with_stdio(false);
| ^~~~~~~~~~~~~~~
|
s285997594 | p02262 | C++ | /**************
* Shell Sort
*************/
#include <cstdio>
#include <vector> //??£?¨?
#include <algorithm>
using namespace std;
typedef vector<int> TList; //??????????????????
void insertionSort(TList& A, int g, int& cnt ){
for(unsigned int i=g ; i<(A.size()); i++){
int v = A[i];
int j = i-g;
while(j>=0 &&... | a.cc: In function 'int main()':
a.cc:78:9: error: 'cout' was not declared in this scope
78 | cout << cnt << endl;
| ^~~~
a.cc:8:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
7 | #include <algorithm>
+++ |+#include <iostrea... |
s323486215 | p02262 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include <bits\stdc++.h>
using namespace std;
int cnt;
vector<int> G;
void insertionSort(vector<int> &A, int n, int g)
{
for (int i = g; i < n; i++)
{
int v = A[i];
int j = i - g;
while (j >= 0 && A[j] > v)
{
A[j + g] = A[j];
j -= g;
cnt++;
}
A[j + g] = v;
}
}
vo... | a.cc:2:10: fatal error: bits\stdc++.h: No such file or directory
2 | #include <bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s928882293 | p02262 | C++ | #include <iostream>
#include <math.h>
#include <sstream>
using namespace std;
string shell_sort(string, int, int, int*);
int* insert_sort_4_shell(int*, int, int);
string intArrayToString(int*, int);
int main()
{
string str;
getline(cin, str);
int num;
stringstream num_ss(str);
num_ss >> num;
getline(cin, str);... | a.cc: In function 'int main()':
a.cc:22:25: error: too many arguments to function 'std::string shell_sort(std::string, int, int, int*)'
22 | str = shell_sort(str, num, m, G, counter);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:8: note: declared here
6 | string shell_sort(string, int... |
s964119109 | p02262 | C++ | #include <iostream>
#include <math.h>
#include <sstream>
using namespace std;
string shell_sort(string, int, int, int*);
int* insert_sort_4_shell(int*, int, int, int&);
string intArrayToString(int*, int, int&);
int main()
{
string str;
getline(cin, str);
int num;
stringstream num_ss(str);
num_ss >> num;
getlin... | a.cc: In function 'int main()':
a.cc:22:25: error: too many arguments to function 'std::string shell_sort(std::string, int, int, int*)'
22 | str = shell_sort(str, num, m, G, counter);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:8: note: declared here
6 | string shell_sort(string, int... |
s502211102 | p02262 | C++ | #include <iostream>
#include <math.h>
#include <sstream>
using namespace std;
string shell_sort(string, int, int, int*, int&);
int* insert_sort_4_shell(int*, int, int, int&);
string intArrayToString(int*, int);
int main()
{
string str;
getline(cin, str);
int num;
stringstream num_ss(str);
num_ss >> num;
str = ... | a.cc:31:1: error: extended character is not valid in an identifier
31 | if (num == 1) {
| ^
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc: ... |
s350175248 | p02262 | C++ | #include <iostream>
#include <math.h>
#include <sstream>
using namespace std;
string shell_sort(string, int, int, int*, int&);
int* insert_sort_4_shell(int*, int, int, int&);
string intArrayToString(int*, int);
int main()
{
string str;
getline(cin, str);
int num;
stringstream num_ss(str);
num_ss >> num;
str = ... | a.cc:31:1: error: extended character is not valid in an identifier
31 | if (num == 1) {
| ^
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc: ... |
s556608672 | p02262 | C++ | #include <iostream>
#include <math.h>
#include <sstream>
using namespace std;
string shell_sort(string, int, int, int*, int&);
int* insert_sort_4_shell(int*, int, int, int&);
string intArrayToString(int*, int);
int main()
{
string str;
getline(cin, str);
int num;
stringstream num_ss(str);
num_ss >> num;
str = ... | a.cc:31:1: error: extended character is not valid in an identifier
31 | if (num == 1) {
| ^
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc: ... |
s162924896 | p02262 | C++ | #include<iostream>
using namespace std;
int m=3;
int G[3] = {4,3,1};
void insertSort(int *a,int n,int g){
int v,i,j;
for(i=g;i<n;i++){
v = a[i];
j = i-g;
while(j>=0&&a[j]>v){
a[j+g] = a[j];
j -= g;
cnt++;
}
a[j+g] = v;
}
}
void shellSort(int *a,int n){
int m = 3,i;
for(i=0;i<m;i++)
insert... | a.cc: In function 'void insertSort(int*, int, int)':
a.cc:15:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
15 | cnt++;
| ^~~
| int
|
s185517269 | p02262 | C++ | #include<iostream>
using namespace std;
int m=3;
int G[3] = {4,3,1};
int insertSort(int *a,int n,int g){
int v,i,j,cnt;
for(i=g;i<n;i++){
v = a[i];
j = i-g;
while(j>=0&&a[j]>v){
a[j+g] = a[j];
j -= g;
cnt++;
}
a[j+g] = v;
}
return cnt;
}
void shellSort(int *a,int n){
int m = 3,i;
for(i=0;i... | a.cc: In function 'int main()':
a.cc:33:24: error: void value not ignored as it ought to be
33 | cnt = shellSort(a,n);
| ~~~~~~~~~^~~~~
|
s536373844 | p02262 | C++ | using System;
class Program
{
public static void Main(string[] args)
{
int n=int.Parse(Console.ReadLine());
int[] array= new int[n];
for(int k=0;k<n;k++)
{
array[k]=int.Parse(Console.ReadLine());
}
int cnt=0;
int m=1;//?????£??????????????°???h=3???m?????????/??? h<n???
int [] G=new ... | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:5:23: error: expected ':' before 'static'
5 | public static void Main(string[] args)
| ^~~~~~~
| :
a.cc:5:41: error: 'string' has no... |
s266303505 | p02262 | C++ | cnt = 0
n = int(raw_input())
A = [int(raw_input()) for _ in range(n)]
G = [1]
while G[-1]*3+1 <= n/3: G.append(G[-1]*3+1)
if n > 256: G.append(n/10*9)
G.reverse()
def insersionSort(g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j... | a.cc:1:1: error: 'cnt' does not name a type; did you mean 'int'?
1 | cnt = 0
| ^~~
| int
|
s614519889 | p02262 | C++ | #include <iostream>
#include <algorithm>
#include<vector>
int G(int num) {
return static_cast<int>(std::pow(10, num));
}
int InsertionSort(std::vector <int> &Sequence, int g) {
int cnt = 0;
for (unsigned int i = g; i < Sequence.size(); ++i) {
int v = Sequence[i];
int j = i - g;
while(j >= 0 && Sequence[j] > v... | a.cc: In function 'int G(int)':
a.cc:5:38: error: 'pow' is not a member of 'std'
5 | return static_cast<int>(std::pow(10, num));
| ^~~
|
s599821676 | p02262 | C++ | #include <iostream>
#include <algorithm>
#include<vector>
int G(int num) {
return static_cast<int>(std::pow(10, num));
}
int InsertionSort(std::vector <int> &Sequence, int g) {
int cnt = 0;
for (unsigned int i = g; i < Sequence.size(); ++i) {
int v = Sequence[i];
int j = i - g;
while(j >= 0 && Sequence[j] > v... | a.cc: In function 'int G(int)':
a.cc:5:38: error: 'pow' is not a member of 'std'
5 | return static_cast<int>(std::pow(10, num));
| ^~~
|
s638833452 | p02262 | C++ | #include<iostream>
using namespace std;
int cnt;
void inSort(int A[],int n,int g){
int i,j,v;
for(i=g;i<n;i++){
v=A[i];
j=i-g;
while(j>=0 && A[j]>v){
A[j+g]=A[j];
j-=g;
++cnt;
}
A[j+g]=v;
}
}
void shSort(int A[],int n){
int i,j,k,l,m,G[20];
m=0;
for(i=1;i<=n;i=i*3+1... | a.cc: In function 'int main()':
a.cc:37:23: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
37 | for(i=0;i<n;i++) cin>A[i];
| ~~~^~~~~
| | |
| | int
| ... |
s526816280 | p02262 | C++ | #include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(){
int S[100]
int top=0;
string s;
while(cin>>s){
if(s=="+") S[top-1]+=S[top--];
else if(s=="-") S[top-1]-=S[top--];
else if(s=="*") S[top-1]*=S[top--];
else S[++top]=atoi(s.c_str());
}
cout<<S[top]<<endl;
... | a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'int'
7 | int top=0;
| ^~~
a.cc:10:16: error: 'S' was not declared in this scope
10 | if(s=="+") S[top-1]+=S[top--];
| ^
a.cc:10:18: error: 'top' was not declared in this scope
10 | if(s=="+") S... |
s706429600 | p02262 | C++ | #include <vector>
using namespace std;
int cnt = 0;
void PrintfArray(int a[], int n)
{
for(int i = 0; i < n; i++)
{
if( i )
cout << endl;
cout << a[i];
}
cout << endl;
}
void insertionSort(int a[], int n, int g)
{
for(int i = g; i < n; i += g)
{
int temp = ... | a.cc: In function 'void PrintfArray(int*, int)':
a.cc:11:13: error: 'cout' was not declared in this scope
11 | cout << endl;
| ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <vector>
+++ |+#... |
s850944184 | p02262 | C++ | #include <iostream>
#include<vector>
int insertion_sort(std::vector<int> a, int n, int gap) {
int count = 0;
for (int i = gap; i < n; ++i) {
int v = a[i];
int j = i - gap;
while (j >= 0 && a[j] > v) {
a[j + gap] = a[j];
j -= gap;
count++;
}
a[j + gap] = v;
}
return count;
}
void shell_sort(std::... | a.cc: In function 'void shell_sort(std::vector<int>, int)':
a.cc:18:13: error: declaration of 'int a []' shadows a parameter
18 | int a[]= { 1,8,23,77,281,1073,4193,16577,65921,262913,1050113 };
| ^
a.cc:17:34: note: 'std::vector<int> a' previously declared here
17 | void shell_sort(std:... |
s895866853 | p02262 | C++ | #include <iostream>
#include<algorithm>
#include<vector>
int insertion_sort(std::vector<int> a, int n, int gap) {
int count = 0;
for (int i = gap; i < n; ++i) {
int v = a[i];
int j = i - gap;
while (j >= 0 && a[j] > v) {
a[j + gap] = a[j];
j -= gap;
count++;
}
a[j + gap] = v;
}
return count;
}
v... | a.cc: In function 'void shell_sort(std::vector<int>, int)':
a.cc:19:13: error: declaration of 'int a []' shadows a parameter
19 | int a[]= { 1,8,23,77,281,1073,4193,16577,65921,262913,1050113 };
| ^
a.cc:18:34: note: 'std::vector<int> a' previously declared here
18 | void shell_sort(std:... |
s834980270 | p02262 | C++ | #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
long long cnt;
int R[1000000];
vector<int> G;
void insertionSort(int R[],int n,int g){
int key;
int j;
for (int i = g; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0; R[j] > key){
R[j + g] = R[j];
j -= g;
cnt++;
}
R... | a.cc:8:1: error: 'vector' does not name a type
8 | vector<int> G;
| ^~~~~~
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:16:30: error: expected ')' before ';' token
16 | while (j >= 0; R[j] > key){
| ~ ^
| )
... |
s039364841 | p02262 | C++ | #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int R[1000000];
vector<int> G;
void insertionSort(int R[],int n,int g){
int key;
int j;
for (int i = g; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0; R[j] > key){
R[j + g] = R... | a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:18:30: error: expected ')' before ';' token
18 | while (j >= 0; R[j] > key){
| ~ ^
| )
a.cc:18:42: error: expected ';' before ')' token
18 | while (j >= ... |
s006261671 | p02262 | C++ | #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int R[1000000];
vector<int> G;
void insertionSort(int R[],int n,int g){
int key;
int j;
for (int i = g; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0; R[j] > key){
R[j + g] = R... | a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:18:30: error: expected ')' before ';' token
18 | while (j >= 0; R[j] > key){
| ~ ^
| )
a.cc:18:42: error: expected ';' before ')' token
18 | while (j >= ... |
s876862359 | p02262 | C++ | #include<stdio.h>
#include<camth>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;
void insertionSort(int R[],int n,int g){
int key;
int g;
for (int i = g; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0 && R[j] > key){
R[j... | a.cc:2:9: fatal error: camth: No such file or directory
2 | #include<camth>
| ^~~~~~~
compilation terminated.
|
s540045441 | p02262 | C++ | #include<stdio.h>
#include<camth>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;
void insertionSort(int R[],int n,int g){
int key;
int g;
for (int i = g; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0 && R[j] > key){
R[j... | a.cc:2:9: fatal error: camth: No such file or directory
2 | #include<camth>
| ^~~~~~~
compilation terminated.
|
s174293649 | p02262 | C++ | #include<stdio.h>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;
void insertionSort(int R[],int n,int g){
int key;
int g;
for (int i = g; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0 && R[j] > key){
R[j... | a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:15:13: error: declaration of 'int g' shadows a parameter
15 | int g;
| ^
a.cc:13:38: note: 'int g' previously declared here
13 | void insertionSort(int R[],int n,int g){
| ~~~~^
a.cc:18:17... |
s382698539 | p02262 | C++ | #include<stdio.h>
#include<camth>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;
void insertionSort(int R[],int n,int g){
int key;
for (int i = g; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0 && R[j] > key){
R[j + g] = ... | a.cc:2:9: fatal error: camth: No such file or directory
2 | #include<camth>
| ^~~~~~~
compilation terminated.
|
s551800063 | p02262 | C++ | #include<stdio.h>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;
void insertionSort(int R[],int n,int g){
int key;
for (int i = g; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0 && R[j] > key){
R[j + g] = ... | a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:17:17: error: 'j' was not declared in this scope
17 | j = i - g;
| ^
|
s023478244 | p02262 | C++ | #include<stdio.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
long long cnt;
int R[1000000];
vector<int> G;
int n;
void insertionSort(int R[], int n, int g){
int key, j;
for (int i = 0, i < n; i++){
key = R[i];
j = i - g;
while (j >= 0 && R[j] < key){
R[j + ... | a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:15:26: error: expected ';' before '<' token
15 | for (int i = 0, i < n; i++){
| ^~
| ;
a.cc:15:27: error: expected primary-expression before '<' token
15 | for (int i = 0, i <... |
s811155078 | p02262 | C++ | #include<stdio.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
long long cnt;
int R[1000000];
vector<int> G;
int n;
void insertionSort(int R[], int n, int g){
int key, j;
for (int i = 0; i < n; i++){
key = R[i];
j = i - g;
while (j >= 0 && R[j] < key){
R[j + ... | a.cc: In function 'void shellSort(int*, int)':
a.cc:35:26: error: too many arguments to function 'void shellSort(int*, int)'
35 | shellSort(R, n, G[i]);
| ~~~~~~~~~^~~~~~~~~~~~
a.cc:27:6: note: declared here
27 | void shellSort(int R[], int n){
| ^~~~~~~~~
|
s838236577 | p02262 | C++ | #include <iostream>
#include <vector>
using namespace std;
long long cnt;
vector<int> G;
void InsertionSort(vector<int> &A, int n, int g)
{
for (int i = g;i < n;i++)
{
int v = A[i];
int j = i - g;
while (j >= 0 && A[j] > v)
{
A[j + g] = A[j];
j -= g;
cnt++;
}
A[j + g] = v;
}
}
void ShellSo... | a.cc: In function 'void ShellSort(std::vector<int>&, int)':
a.cc:34:9: error: 'reverse' was not declared in this scope
34 | reverse(G.begin(), G.end());
| ^~~~~~~
|
s381701491 | p02262 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
static int cnt = 0;
void printArray(int a[],int n){
for(int i=0;i<n;i++){
cout << a[i];
if(i != n-1)
cout << endl;
}
}
void insertSort(int a[],int n,int g){
for(int i=g;i<n;i++){
int v = a[i];
int j = i... | a.cc: In function 'void shellSort(int*, int)':
a.cc:25:5: error: 'vector' was not declared in this scope
25 | vector<int> G;
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <algorithm>
+++ |+#include <vect... |
s963048024 | p02262 | C++ | include <iostream>
#include <cmath>
using namespace std;
static const int m_MAX = 100;
static const int n_MAX = 1000000;
int insertionSort(int A[], int n, int g) {
int i, j, v, cnt = 0;
for (i = g; i < n; i++) {
v = A[i];
j = i - g;
while (j >= 0 && A[j] > v) {
A[j+g] = A[j];
j = j - g;
cnt++;
A... | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/cmath:45,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
1... |
s033210238 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int>G;
void insertionSort(int A[],int n,int g){
for(int i=g;i<n;i++){
int v=A[i];
int j=i-g;
while(j>=0&&A[j]>v){
A[j+g]=A[j];
j-=g;
cnt++;
... | a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:23:24: error: 'V' was not declared in this scope
23 | A[j+g]=V;
| ^
a.cc: In function 'int main()':
a.cc:46:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'}... |
s941284313 | p02262 | C++ | #include <cstdio>
#include <vector>
using namespace std;
int cnt,m;
vector<int> G;
void insertionSort(vector<int>& a, int n, int g) {
for(int i=g; i<n; ++i) {
int j,v=a[i];
for(j=i-g; j>=0 && a[j]>v;j-=g) {
swap(a[j+g],a[j]);
++cnt;
}
a[j+g]=v;
}
}
void shellSort(vector<int>& a,int n) {
cnt = 0;
m=... | a.cc: In function 'int main()':
a.cc:48:9: error: 'cout' was not declared in this scope
48 | cout << m << endl;
| ^~~~
a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <vector>
+++ |+#include <iostream>
... |
s686436322 | p02262 | C++ |
#include <iostream>
//#include <conio.h>
using namespace std;
int main()
{
int n;
int key;
int h[10];
h[0] =1;
int dem = 0;
cin>>n;
int a[100000];
for (int i = 0; i < n; i++)
cin>>a[i];
int step,i,j, x,len, k = 0;
int s = 0;
while (k < n)
{
k = s*3 + 1;
s++;
}
for (int i = 0; i < s - 1; i++)
{
... | a.cc: In function 'int main()':
a.cc:53:34: warning: NULL used in arithmetic [-Wpointer-arith]
53 | if (h[0] == 1 && h[1] == NULL)
| ^~~~
a.cc:70:9: error: 'getch' was not declared in this scope; did you mean 'getc'?
70 | getch();
| ^~~~~
... |
s357941665 | p02262 | C++ |
#include <iostream>
//#include <conio.h>
using namespace std;
int main()
{
int n;
int key;
int h[10];
h[0] =1;
int dem = 0;
cin>>n;
int a[100000];
for (int i = 0; i < n; i++)
cin>>a[i];
int step,i,j, x,len, k = 0;
int s = 0;
while (k < n)
{
k = s*3 + 1;
s++;
}
for (int i = 0; i < s - 1; i++)
{
... | a.cc: In function 'int main()':
a.cc:53:34: warning: NULL used in arithmetic [-Wpointer-arith]
53 | if (h[0] == 1 && h[1] == NULL)
| ^~~~
a.cc:70:9: error: 'getch' was not declared in this scope; did you mean 'getc'?
70 | getch();
| ^~~~~
... |
s295725891 | p02262 | C++ | #include <iostream>
#define rep(i, first, to) for(ll i = first; i < to; ++i)
#define REP(i, first, to) for(ll i = first; i <= to; ++i)
using namespace std;
typedef long long ll;
int cnt = 0;
int a[1000001];
int n;
int g[1000001];
void show(int *p) {
rep(i, 0, n - 1) {
cout << p[i] << " ";
}
cout << p[n - 1] <<... | a.cc: In function 'void solve()':
a.cc:60:10: error: expected '}' at end of input
60 | }
| ^
a.cc:56:14: note: to match this '{'
56 | void solve() {
| ^
|
s035007498 | p02262 | C++ | #include<cstdio>
#include<vector>
void insertionSort(std::vector<int> &A,int g,int &count){
for(int i=g;i<A.size();i++){
int tmp = A[i];
int j=i-g;
while(j>=0 && A[j]>tmp){
A[j+g]=A[j];
j-=g;
count++;
}
A[j+g]=tmp;
}
}
std::vector<int> shellsort(std::vector<int> &A,int ... | a.cc: In function 'int main()':
a.cc:47:7: error: 'i' was not declared in this scope
47 | for(i=G.size()-1;i>=0;i--){
| ^
a.cc:47:9: error: 'G' was not declared in this scope
47 | for(i=G.size()-1;i>=0;i--){
| ^
a.cc:49:9: error: expected ')' before '!' token
49 | if(i!){print... |
s687383330 | p02262 | C++ | #include<cstdio>
#include<vector>
void insertionSort(std::vector<int> &A,int g,int &count){
for(int i=g;i<A.size();i++){
int tmp = A[i];
int j=i-g;
while(j>=0 && A[j]>tmp){
A[j+g]=A[j];
j-=g;
count++;
}
A[j+g]=tmp;
}
}
std::vector<int> shellsort(std::vector<int> &A,int ... | a.cc: In function 'int main()':
a.cc:47:13: error: 'G' was not declared in this scope
47 | for(int i=G.size()-1;i>=0;i--){
| ^
a.cc:49:9: error: expected ')' before '!' token
49 | if(i!){printf(" ");}else{printf("\n")}
| ~ ^
| )
a.cc:49:42: error: expected ';' bef... |
s128240728 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;
void insertionSort(int A[],int n int g){
for(int i=g;i<n;i++){
int v = A[i];
int j= i-g;
while(j>=0 && A[j] > v){
A[j+g]=A[j];
j -= g;... | a.cc:15:34: error: expected ',' or '...' before 'int'
15 | void insertionSort(int A[],int n int g){
| ^~~
a.cc: In function 'void insertionSort(int*, int)':
a.cc:16:19: error: 'g' was not declared in this scope
16 | for(int i=g;i<n;i++){
| ^
a... |
s269360770 | p02262 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;
void insertionSort(int A[],int n,int g){
for(int i=g;i<n;i++){
int v = A[i];
int j= i-g;
while(j>=0 && A[j] > v){
A[j+g]=A[j];
j -= g;... | a.cc: In function 'int main()':
a.cc:43:17: error: expected ';' before 'for'
43 | cin >> n
| ^
| ;
44 |
45 | for(int i=0;i<n;i++){
| ~~~
a.cc:45:21: error: 'i' was not declared in this scope
45 | for(int i=0;i<n;i++){
... |
s630024446 | p02262 | C++ | import math
def insertionSort(A,n,g,cnt):
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
return A,cnt
def shellSort(A,n):
cnt = 0
#m = n//2 + 1
#G = [2*i + 1*(i==0) for i in range(m)[::-1]]
m = int(math.log(n,2)) + 1
G = [2**i for... | a.cc:16:10: error: invalid preprocessing directive #m
16 | #m = n//2 + 1
| ^
a.cc:17:10: error: invalid preprocessing directive #G
17 | #G = [2*i + 1*(i==0) for i in range(m)[::-1]]
| ^
a.cc:24:16: warning: multi-character literal with 8 characters exceeds 'int' size ... |
s019883103 | p02262 | C++ | #include <stdio.h>
#include <iostream>
#include <utility>
using namespace std;
#define M 5
int shellSort(int a[], int n, int m);
int insertionSort(int a[], int n, int g);
int main(void)
{
int n, a[100];
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
shellSort(a, n, M);
return 0;
}
int shellSort(int a[... | a.cc: In function 'int insertionSort(int*, int, int)':
a.cc:55:30: error: expected ';' before '}' token
55 | cnt++
| ^
| ;
56 | }
| ~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.