submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s257616748 | p03784 | C++ | #i
#d
us
in
}
in
in
}
vo
}
in
in
} | a.cc:1:2: error: invalid preprocessing directive #i; did you mean #if?
1 | #i
| ^
| if
a.cc:2:2: error: invalid preprocessing directive #d
2 | #d
| ^
a.cc:3:1: error: 'us' does not name a type
3 | us
| ^~
a.cc:8:1: error: expected declaration before '}' token
8 | }
| ^
a.cc:9:1: error: 'in' does not name a type; did you mean 'int'?
9 | in
| ^~
| int
a.cc:12:1: error: expected declaration before '}' token
12 | }
| ^
a.cc:13:1: error: 'vo' does not name a type; did you mean 'void'?
13 | vo
| ^~
| void
a.cc:18:1: error: expected declaration before '}' token
18 | }
| ^
a.cc:19:1: error: 'in' does not name a type; did you mean 'int'?
19 | in
| ^~
| int
a.cc:48:1: error: expected declaration before '}' token
48 | }
| ^
|
s946455412 | p03784 | C++ | v#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 19260817
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
int res[Maxk];
memset(res,0,sizeof(res));
reverse(a.begin(),a.end());
reverse(b.begin(),b.end());
for (int i=0;i<a.length();i++){
for (int j=0;j<b.length();j++){
res[i+j]+=(a[i]-'0')*(b[j]-'0');
}
}
for (int i=0;i<Maxk;i++){
if (res[i]>=10) {
res[i+1]+=(res[i]/10);
res[i]%=10;
}
}
string ret;
bool flag=false;
for (int i=Maxk-1;i>=0;i--){
if (flag || res[i]){
flag=true;
ret=ret+(char)(res[i]+'0');
}
}
if (ret=="") ret="0";
return ret;
}
string add(string a,string b){
if (a.length()<b.length()) swap(a,b);
while (a.length()!=b.length()){
b='0'+b;
}
for (int i=a.length()-1;i>=0;i--){
a[i]+=(b[i]-'0');
if (a[i]>'9' && i){
a[i]-=10;
a[i-1]++;
}
}
if (a[0]>'9'){
a[0]-=10;
a='1'+a;
}
return a;
}
// cf IO: I64d
// atcoder IO: lld
const int Maxn=4005;
char ans[Maxn];
char ask(int x,int y){
printf("? %d %d\n",x,y);
fflush(stdout);
char c;
scanf("\n%c",&c);
return c;
}
vector<int> now;
int main(){
int a,b;
scanf("%d %d",&a,&b);
if (b>=a){
printf("Impossible\n");
fflush(stdout);
return 0;
}
now.push_back(0);
for (int i=1;i<a+b;i++){
if (now.empty()){
now.push_back(i);
continue;
}
int x=now.back();
char c=ask(x,i);
if (c=='N'){
now.pop_back();
//cerr<<123<<endl;
}
else{
now.push_back(i);
}
}
int t=now.back();
for (int i=0;i<a+b;i++){
char c=ask(t,i);
if (c=='N') ans[i]='0'; else ans[i]='1';
}
ans[a+b]='\0';
printf("! %s\n",ans);
fflush(stdout);
return 0;
}
| a.cc:1:2: error: stray '#' in program
1 | v#include <iostream>
| ^
a.cc:1:1: error: 'v' does not name a type; did you mean 'vi'?
1 | v#include <iostream>
| ^
| vi
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/istream:40,
from /usr/include/c++/14/sstream:40,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c+ |
s408900813 | p03784 | C++ | #include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <cctype>
#include <cmath>
#include <vector>
#include <sstream>
#include <bitset>
#include <deque>
#include <iomanip>
using namespace std;
#define pr(x) cout << #x << " = " << x << endl;
#define bug cout << "bugbug" << endl;
#define ppr(x, y) printf("(%d, %d)\n", x, y);
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define SQR(a) ((a)*(a))
#define PCUT puts("\n---------------")
typedef long long ll;
typedef double DBL;
typedef pair<int, int> P;
typedef unsigned int uint;
const int MOD = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 4e3 + 4;
const int maxm = 1e4 + 4;
const double pi = acos(-1.0);
int A, B, n;
int kind[maxn], result[maxn], cnt[2];
char s[maxn];
int main(){
//必须编译过才能交
int ik, i, j, k, kase;
scanf("%d%d", &A, &B);
int tot = (A+B) * 2;
int maxv = max((B*B+3*B+2*A-4) / 2, (B+3)*B/2);
if (tot < maxv || A <= B){
printf("Impossible");
fflush(stdout);
return 0;
}
n = A + B;
memset(kind, -1, sizeof kind);
bool ok = false;
int cur = n - 1;
while(!ok){
cnt[0] = cnt[1] = 0;
for (i = 0; i < n; ++i){
if (kind[i] != -1) continue;
printf("? %d %d\n", i, cur);
fflush(stdout);
scanf("%s", s);
result[i] = s[0] == 'Y' ? 1 : 0;
cnt[result[i]]++;
if (cnt[result[i]] > B){
if (result[i] == 1) ok = true, A--, kind[cur] = 1;
else B--, kind[cur] = 0;
for (j = 0; j < i; ++j)
if (kind[j] == -1 && result[j] != result[i]){
kind[j] = 0;
B--;
}
}
}
if (B == 0){
for (i = 0; i < n; ++i) if (kind[i] == -1 ) kind[i] = 1;
break;
}
}
if (kind[cur] == 1){
for (int i = 0 ; i < n; ++i)
if (kind[i] == -1){
printf("? %d %d\n", cur, i);
fflush(stdout);
scanf("%s", s);
kind[i] = s[0] == 'Y' ? 1 : 0;
}
}
printf("! ");
for (i = 0; i < n; ++i) printf("%d", kind[i]);
printf("\n");
fflush(stdout);
return 0;
}
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <cctype>
#include <cmath>
#include <vector>
#include <sstream>
#include <bitset>
#include <deque>
#include <iomanip>
using namespace std;
#define pr(x) cout << #x << " = " << x << endl;
#define bug cout << "bugbug" << endl;
#define ppr(x, y) printf("(%d, %d)\n", x, y);
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define SQR(a) ((a)*(a))
#define PCUT puts("\n---------------")
typedef long long ll;
typedef double DBL;
typedef pair<int, int> P;
typedef unsigned int uint;
const int MOD = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 4e3 + 4;
const int maxm = 1e4 + 4;
const double pi = acos(-1.0);
int A, B, n;
int kind[maxn], result[maxn], cnt[2];
char s[maxn];
int main(){
//必须编译过才能交
int ik, i, j, k, kase;
scanf("%d%d", &A, &B);
int tot = (A+B) * 2;
int maxv = max((B*B+3*B+2*A-4) / 2, (B+3)*B/2);
if (tot < maxv || A <= B){
printf("Impossible");
fflush(stdout);
return 0;
}
n = A + B;
memset(kind, -1, sizeof kind);
bool ok = false;
int cur = n - 1;
while(!ok){
cnt[0] = cnt[1] = 0;
for (i = 0; i < n; ++i){
if (kind[i] != -1) continue;
printf("? %d %d\n", i, cur);
fflush(stdout);
scanf("%s", s);
result[i] = s[0] == 'Y' ? 1 : 0;
cnt[result[i]]++;
if (cnt[result[i]] > B){
if (result[i] == 1) ok = true, A--, kind[cur] = 1;
else B--, kind[cur] = 0;
for (j = 0; j < i; ++j)
if (kind[j] == -1 && result[j] != result[i]){
kind[j] = 0;
B--;
}
}
}
if (B == 0){
for (i = 0; i < n; ++i) if (kind[i] == -1 ) kind[i] = 1;
break;
}
}
if (kind[cur] == 1){
for (int i = 0 ; i < n; ++i)
if (kind[i] == -1){
printf("? %d %d\n", cur, i);
fflush(stdout);
scanf("%s", s);
kind[i] = s[0] == 'Y' ? 1 : 0;
}
}
printf("! ");
for (i = 0; i < n; ++i) printf("%d", kind[i]);
printf("\n");
fflush(stdout);
return 0;
}
| a.cc:122:11: error: redefinition of 'const int MOD'
122 | const int MOD = 1e9 + 7;
| ^~~
a.cc:30:11: note: 'const int MOD' previously defined here
30 | const int MOD = 1e9 + 7;
| ^~~
a.cc:123:11: error: redefinition of 'const int inf'
123 | const int inf = 0x3f3f3f3f;
| ^~~
a.cc:31:11: note: 'const int inf' previously defined here
31 | const int inf = 0x3f3f3f3f;
| ^~~
a.cc:124:10: error: redefinition of 'const ll INF'
124 | const ll INF = 0x3f3f3f3f3f3f3f3f;
| ^~~
a.cc:32:10: note: 'const ll INF' previously defined here
32 | const ll INF = 0x3f3f3f3f3f3f3f3f;
| ^~~
a.cc:125:11: error: redefinition of 'const int maxn'
125 | const int maxn = 4e3 + 4;
| ^~~~
a.cc:33:11: note: 'const int maxn' previously defined here
33 | const int maxn = 4e3 + 4;
| ^~~~
a.cc:126:11: error: redefinition of 'const int maxm'
126 | const int maxm = 1e4 + 4;
| ^~~~
a.cc:34:11: note: 'const int maxm' previously defined here
34 | const int maxm = 1e4 + 4;
| ^~~~
a.cc:127:14: error: redefinition of 'const double pi'
127 | const double pi = acos(-1.0);
| ^~
a.cc:35:14: note: 'const double pi' previously defined here
35 | const double pi = acos(-1.0);
| ^~
a.cc:128:5: error: redefinition of 'int A'
128 | int A, B, n;
| ^
a.cc:36:5: note: 'int A' previously declared here
36 | int A, B, n;
| ^
a.cc:128:8: error: redefinition of 'int B'
128 | int A, B, n;
| ^
a.cc:36:8: note: 'int B' previously declared here
36 | int A, B, n;
| ^
a.cc:128:11: error: redefinition of 'int n'
128 | int A, B, n;
| ^
a.cc:36:11: note: 'int n' previously declared here
36 | int A, B, n;
| ^
a.cc:129:5: error: redefinition of 'int kind [4004]'
129 | int kind[maxn], result[maxn], cnt[2];
| ^~~~
a.cc:37:5: note: 'int kind [4004]' previously declared here
37 | int kind[maxn], result[maxn], cnt[2];
| ^~~~
a.cc:129:17: error: redefinition of 'int result [4004]'
129 | int kind[maxn], result[maxn], cnt[2];
| ^~~~~~
a.cc:37:17: note: 'int result [4004]' previously declared here
37 | int kind[maxn], result[maxn], cnt[2];
| ^~~~~~
a.cc:129:31: error: redefinition of 'int cnt [2]'
129 | int kind[maxn], result[maxn], cnt[2];
| ^~~
a.cc:37:31: note: 'int cnt [2]' previously declared here
37 | int kind[maxn], result[maxn], cnt[2];
| ^~~
a.cc:130:6: error: redefinition of 'char s [4004]'
130 | char s[maxn];
| ^
a.cc:38:6: note: 'char s [4004]' previously declared here
38 | char s[maxn];
| ^
a.cc:131:5: error: redefinition of 'int main()'
131 | int main(){
| ^~~~
a.cc:39:5: note: 'int main()' previously defined here
39 | int main(){
| ^~~~
|
s067227853 | p03784 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
int N,A,B;
int ret[2020];
int ask(int a,int b) {
char buf[1010];
_P("? %d %d\n",a,b);
fflush(stdout);
scanf("%s",buf);
return buf[0]=='Y';
}
void solve() {
int i,j,k,l,r,x,y; string s;
scanf("%d%d",&A,&B);
if(A<=B) {
_P("Impossible\n");
return;
}
N=A+B;
vector<int> path;
FOR(i,N) {
if(path.empty() || ask(path.back(),i))
path.push_back(i);
}
else {
path.pop_back();
}
if(path.size()>B) break;
}
x = path.back();
FOR(i,N) ret[i]=ask(x,i);
_P("!");
FOR(i,N) _P("%d",ret[i]);
_P("\n");
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n';
FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
solve(); return 0;
}
| a.cc: In function 'void solve()':
a.cc:42:17: error: 'else' without a previous 'if'
42 | else {
| ^~~~
a.cc:45:35: error: break statement not within loop or switch
45 | if(path.size()>B) break;
| ^~~~~
a.cc: At global scope:
a.cc:48:9: error: 'x' does not name a type
48 | x = path.back();
| ^
a.cc:7:19: error: expected unqualified-id before 'for'
7 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^~~
a.cc:49:9: note: in expansion of macro 'FOR'
49 | FOR(i,N) ret[i]=ask(x,i);
| ^~~
a.cc:49:13: error: 'i' does not name a type
49 | FOR(i,N) ret[i]=ask(x,i);
| ^
a.cc:7:27: note: in definition of macro 'FOR'
7 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^
a.cc:49:13: error: 'i' does not name a type
49 | FOR(i,N) ret[i]=ask(x,i);
| ^
a.cc:7:34: note: in definition of macro 'FOR'
7 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^
a.cc:6:18: error: expected unqualified-id before 'void'
6 | #define _P(...) (void)printf(__VA_ARGS__)
| ^~~~
a.cc:50:9: note: in expansion of macro '_P'
50 | _P("!");
| ^~
a.cc:6:18: error: expected ')' before 'void'
6 | #define _P(...) (void)printf(__VA_ARGS__)
| ~^~~~
a.cc:50:9: note: in expansion of macro '_P'
50 | _P("!");
| ^~
a.cc:7:19: error: expected unqualified-id before 'for'
7 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^~~
a.cc:51:9: note: in expansion of macro 'FOR'
51 | FOR(i,N) _P("%d",ret[i]);
| ^~~
a.cc:51:13: error: 'i' does not name a type
51 | FOR(i,N) _P("%d",ret[i]);
| ^
a.cc:7:27: note: in definition of macro 'FOR'
7 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^
a.cc:51:13: error: 'i' does not name a type
51 | FOR(i,N) _P("%d",ret[i]);
| ^
a.cc:7:34: note: in definition of macro 'FOR'
7 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^
a.cc:6:18: error: expected unqualified-id before 'void'
6 | #define _P(...) (void)printf(__VA_ARGS__)
| ^~~~
a.cc:52:9: note: in expansion of macro '_P'
52 | _P("\n");
| ^~
a.cc:6:18: error: expected ')' before 'void'
6 | #define _P(...) (void)printf(__VA_ARGS__)
| ~^~~~
a.cc:52:9: note: in expansion of macro '_P'
52 | _P("\n");
| ^~
a.cc:58:1: error: expected declaration before '}' token
58 | }
| ^
|
s866269848 | p03784 | C++ | #include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <functional>
#include <queue>
#include <map>
#include <set>
#include <string>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
char str[5];
int main()
{
int A,B;
scanf("%d %d",&A,&B);
if(A<=B)
{
puts("Impossible");
return 0;
}
vector <int> nxt;
for(int i=0;i<A+B;i++) nxt.push_back(i);
while(nxt.size()>1)
{
vector <int> zan;
for(int i=0;i<nxt.size();i+=2)
{
if(i+1<nxt.size())
{
printf("? %d %d\n",nxt[i],nxt[i+1]);
fflush(stdout);
scanf("%s",&str);
if(str[0]=='Y')
{
printf("? %d %d\n",nxt[i+1],nxt[i]);
fflush(stdout);
scanf("%s",&str);
if(str[0]=='Y')
{
zan.push_back(nxt[i]);
}
}
}
else zan.push_back(nxt[i]);
}
nxt=zan;
}
int v=nxt[0];
vector <int> ans;
for(int i=0;i<A+B;i++)
{
printf("? %d %d\n",v,i);
fflush(stdout);
scanf("%s",&str);
ans.push_back(str[0]=='Y'?1:0);
}
printf("! ");
for(int i=0;i<ans.size();i++) printf("%d",ans[i]);
puts("");
return 0;
}
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <functional>
#include <queue>
#include <map>
#include <set>
#include <string>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
char str[5];
int main()
{
int A,B;
scanf("%d %d",&A,&B);
if(A<=B)
{
puts("Impossible");
return 0;
}
vector <int> nxt;
for(int i=0;i<A+B;i++) nxt.push_back(i);
while(nxt.size()>1)
{
vector <int> zan;
for(int i=0;i<nxt.size();i+=2)
{
if(i+1<nxt.size())
{
printf("? %d %d\n",nxt[i],nxt[i+1]);
fflush(stdout);
scanf("%s",&str);
if(str[0]=='Y')
{
printf("? %d %d\n",nxt[i+1],nxt[i]);
fflush(stdout);
scanf("%s",&str);
if(str[0]=='Y')
{
zan.push_back(nxt[i]);
}
}
}
else zan.push_back(nxt[i]);
}
nxt=zan;
}
int v=nxt[0];
vector <int> ans;
for(int i=0;i<A+B;i++)
{
printf("? %d %d\n",v,i);
fflush(stdout);
scanf("%s",&str);
ans.push_back(str[0]=='Y'?1:0);
}
printf("! ");
for(int i=0;i<ans.size();i++) printf("%d",ans[i]);
puts("");
return 0;
}
| a.cc:83:6: error: redefinition of 'char str [5]'
83 | char str[5];
| ^~~
a.cc:16:6: note: 'char str [5]' previously declared here
16 | char str[5];
| ^~~
a.cc:85:5: error: redefinition of 'int main()'
85 | int main()
| ^~~~
a.cc:18:5: note: 'int main()' previously defined here
18 | int main()
| ^~~~
|
s504566644 | p03784 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
int A,B;
int ask(int a,int b) {
char buf[1010];
_P("? %d %d\n",a,b);
fflush();
scanf("%s",buf);
return buf[0]=='Y';
}
void solve() {
int i,j,k,l,r,x,y; string s;
scanf("%d%d",&A,&B);
if(A<=B) {
_P("Impossible\n");
return;
}
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n';
FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
solve(); return 0;
}
| a.cc: In function 'int ask(int, int)':
a.cc:21:15: error: too few arguments to function 'int fflush(FILE*)'
21 | fflush();
| ~~~~~~^~
In file included from /usr/include/c++/14/cstdio:42,
from /usr/include/c++/14/ext/string_conversions.h:45,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/stdio.h:236:12: note: declared here
236 | extern int fflush (FILE *__stream);
| ^~~~~~
|
s422716867 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, C, K;
cin >> N >> C >> K;
vector<int> T(N);
for(int i = 0; i < N; i++){
cin >> T.at(i);
}
sort(T.start(), T.end());
int res = 0;
for(int i = 0; i < N){
res++;
int start = i;
while(i < N && T[i] - T[start] <= K &&
i - start < C) i++;
}
cout << res << endl;
}
| a.cc: In function 'int main()':
a.cc:13:10: error: 'class std::vector<int>' has no member named 'start'
13 | sort(T.start(), T.end());
| ^~~~~
a.cc:15:23: error: expected ';' before ')' token
15 | for(int i = 0; i < N){
| ^
| ;
|
s784863407 | p03785 | C++ | //コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;
//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x
signed main(){
//入力の高速化用のコード
ios::sync_with_stdio(false);
cin.tie(nullptr);
//入力
ll N = 0, C =0, K=0;
cin >> N >> C >> K;
vll T(N);
REP(i,N){cin >> T[i];}
//本文
if(C==1){
cout << N << endl;
return 0;
}
sort(ALL(T));
ll cnt = 0;
for(int i =0; i<N;i++){
if(i == N-1){
cnt++;
break;
}
for(int j = i+1;j<N;j++){
if(T[i]+K < t[j]){
cnt++; i =j-1;
break;
}
else{
if(j-i <= C) continue;
else{
cnt++; i =j-1;
break;
}
}
}
}
//出力
cout << cnt << endl;
//REP(i,N) cout << ans.at(i) <<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:93:21: error: 't' was not declared in this scope
93 | if(T[i]+K < t[j]){
| ^
|
s595199256 | p03785 | C++ | //コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;
//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x
signed main(){
//入力の高速化用のコード
ios::sync_with_stdio(false);
cin.tie(nullptr);
//入力
ll N = 0, C =0, K=0;
cin >> N >> C >> K;
vll T(N);
REP(i,N){cin >> T[i];}
//本文
if(C==1){
cout << N << endl;
return 0;
}
sort(ALL(T));
ll cnt = 0;
for(int i =0; i<N;i++){
if(i == N-1){
cnt++;
break;
}
for(int j = i+1;j<N;j++){
if(T[i]+k < t[j]){
cnt++; i =j-1;
break;
}
else{
if(j-i <= C) continue;
else{
cnt++; i =j-1;
break;
}
}
}
}
//出力
cout << cnt << endl;
//REP(i,N) cout << ans.at(i) <<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:93:17: error: 'k' was not declared in this scope
93 | if(T[i]+k < t[j]){
| ^
a.cc:93:21: error: 't' was not declared in this scope
93 | if(T[i]+k < t[j]){
| ^
|
s008759964 | p03785 | C++ | //コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;
//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x
signed main(){
//入力の高速化用のコード
ios::sync_with_stdio(false);
cin.tie(nullptr);
//入力
ll N = 0, C =0, K=0;
cin >> N >> C >> K;
vll T(N);
REP(i,N){cin >> T[i];}
//本文
if(C=1){
cout << N << endl;
return 0;
}
sort(ALL(T));
ll cnt = 0;
for(int i =0; i<N;i++){
if(i == N-1){
cnt++;
break;
}
if(int j =i+1;j<N;j++){
if(T[i]+k < t[j]){
cnt++; i =j-1;
break;
}
else{
if(j-i <= C) continue;
else{
cnt++; i =j-1;
break;
}
}
}
}
//出力
cout << cnt << endl;
//REP(i,N) cout << ans.at(i) <<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:92:24: error: expected ')' before ';' token
92 | if(int j =i+1;j<N;j++){
| ~ ^
| )
a.cc:92:25: error: 'j' was not declared in this scope
92 | if(int j =i+1;j<N;j++){
| ^
|
s386453323 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
main(){
int n,c,k;cin >> n >> c >> k;
vector<int> t(n);for(int i=0;i<n;i++) cin >> t[i];
sort(t.begin(),t.end());
int ans=0;
for(int i = 0; i<n;){
ans++;
int j = i;
while(i-j<c && t[i]-t[j]<=k && i<n){
i++;
}
}
cout << bus << endl;
return 0;
} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:15:11: error: 'bus' was not declared in this scope
15 | cout << bus << endl;
| ^~~
|
s937008740 | p03785 | C++ | #nclude <bits/stdc++.h>
using namespace std;
int main(){
int n,c,k;
cin >> n >> c >> k;
int t[n];
for(int i =0;i<n;i++) cin >> t[i];
sort(t,t+n);
int bus=0;
for(int i=0;i<n;){
for(int j=i+c;j<=i;j--){
if(t[i]+k>=t[j-1]){
i+=j+1;
bus++;
break;
}
}
}
cout << bus << endl;
} | a.cc:1:2: error: invalid preprocessing directive #nclude; did you mean #include?
1 | #nclude <bits/stdc++.h>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin >> n >> c >> k;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #nclude <bits/stdc++.h>
a.cc:10:1: error: 'sort' was not declared in this scope; did you mean 'short'?
10 | sort(t,t+n);
| ^~~~
| short
a.cc:22:1: error: 'cout' was not declared in this scope
22 | cout << bus << endl;
| ^~~~
a.cc:22:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:16: error: 'endl' was not declared in this scope
22 | cout << bus << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #nclude <bits/stdc++.h>
|
s564273189 | p03785 | C++ | #nclude <bits/stdc++.h>
using namespace std;
int main(){
int n,c,k;
cin >> n >> c >> k;
int d[n];
for(int i =0;i<n;i++) cin >> t[i];
sort(t,t+n);
int bus=0;
for(int i=0;i<n;){
for(int j=i+c;j<=i;j--){
if(t[i]+k>=t[j-1]){
i+=j+1;
bus++;
break;
}
}
}
cout << bus << endl;
} | a.cc:1:2: error: invalid preprocessing directive #nclude; did you mean #include?
1 | #nclude <bits/stdc++.h>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin >> n >> c >> k;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #nclude <bits/stdc++.h>
a.cc:8:32: error: 't' was not declared in this scope
8 | for(int i =0;i<n;i++) cin >> t[i];
| ^
a.cc:10:6: error: 't' was not declared in this scope
10 | sort(t,t+n);
| ^
a.cc:10:1: error: 'sort' was not declared in this scope; did you mean 'short'?
10 | sort(t,t+n);
| ^~~~
| short
a.cc:22:1: error: 'cout' was not declared in this scope
22 | cout << bus << endl;
| ^~~~
a.cc:22:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:16: error: 'endl' was not declared in this scope
22 | cout << bus << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #nclude <bits/stdc++.h>
|
s514450449 | p03785 | C++ | // g++ .cpp && ./a.out
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> p;
typedef long long ll;
const int mod = 1000000007;
const int inf = 1000000007;
int main() {
int n, c, k;
cin >> n >> c >> k;
vector<int> t(n);
rep(i, n) cin >> t[i];
int num = 1;
int res = 1;
int mx = t[0] + k;
for (int i = 1; i < n; i++) {
if (num == c || mx < t[i]) {
res++;
num = 1;
mx = t[i] + k:
} else {
num++:
}
}
cout << res << endl;
} | a.cc: In function 'int main()':
a.cc:24:20: error: expected ';' before ':' token
24 | mx = t[i] + k:
| ^
| ;
a.cc:26:12: error: expected ';' before ':' token
26 | num++:
| ^
| ;
|
s350545380 | p03785 | C++ | // g++ .cpp && ./a.out
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 1; i < (n); ++i)
using namespace std;
typedef pair<int, int> p;
typedef long long ll;
const int mod = 1000000007;
const int inf = 1000000007;
int main() {
int n, c, k;
cin >> n >> c >> k;
vector<int> t(n);
rep(i, n) cin >> t[i];
int num = 1;
int res = 1;
int mx = t[0] + k;
for (int i = 1; i < n; i++) {
if (num == c || mx < t[i]) {
res++;
num = 1;
mx = t[i] + k:
} else {
num++:
}
}
cout << res << endl;
} | a.cc: In function 'int main()':
a.cc:24:20: error: expected ';' before ':' token
24 | mx = t[i] + k:
| ^
| ;
a.cc:26:12: error: expected ';' before ':' token
26 | num++:
| ^
| ;
|
s591128378 | p03785 | C++ | #define rep(i,n) for (int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, c, k; cin >> n >> c >> k;
priority_queue<int, vector<int>, greater<int>> arrival;
priority_queue<int, vector<int>, greater<int>> limit;
int ans = 0;
rep(i,n) {
int t; cin >> t;
arrival.push(t);
limit.push(t+k);
}
int now = 0;
queue<int> train;
while(!arrival.empty()) {
now++;
while(now == arrival.top()) {
if (!arrival.empty() && train.size() < c) {
train.push(arrival.top());
arrival.pop();
} else break;
}
if (now == limit.top() || train.size() >= c) {
ans++;
while(!train.empty()) {
train.pop();
limit.pop();
}
}
}
if (!train.empty()) {
train.pop();
ans++;
}
cout << ans << endl;
return 0;
} | a.cc:5:11: error: 'pair' does not name a type
5 | using P = pair<int, int>;
| ^~~~
a.cc: In function 'int main()':
a.cc:8:16: error: 'cin' was not declared in this scope
8 | int n, c, k; cin >> n >> c >> k;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #define rep(i,n) for (int i=0; i<(int)(n); i++)
a.cc:9:3: error: 'priority_queue' was not declared in this scope
9 | priority_queue<int, vector<int>, greater<int>> arrival;
| ^~~~~~~~~~~~~~
a.cc:1:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
+++ |+#include <queue>
1 | #define rep(i,n) for (int i=0; i<(int)(n); i++)
a.cc:9:18: error: expected primary-expression before 'int'
9 | priority_queue<int, vector<int>, greater<int>> arrival;
| ^~~
a.cc:10:18: error: expected primary-expression before 'int'
10 | priority_queue<int, vector<int>, greater<int>> limit;
| ^~~
a.cc:14:5: error: 'arrival' was not declared in this scope
14 | arrival.push(t);
| ^~~~~~~
a.cc:15:5: error: 'limit' was not declared in this scope
15 | limit.push(t+k);
| ^~~~~
a.cc:18:3: error: 'queue' was not declared in this scope
18 | queue<int> train;
| ^~~~~
a.cc:18:3: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
a.cc:18:9: error: expected primary-expression before 'int'
18 | queue<int> train;
| ^~~
a.cc:19:10: error: 'arrival' was not declared in this scope
19 | while(!arrival.empty()) {
| ^~~~~~~
a.cc:22:31: error: 'train' was not declared in this scope
22 | if (!arrival.empty() && train.size() < c) {
| ^~~~~
a.cc:27:16: error: 'limit' was not declared in this scope
27 | if (now == limit.top() || train.size() >= c) {
| ^~~~~
a.cc:27:31: error: 'train' was not declared in this scope
27 | if (now == limit.top() || train.size() >= c) {
| ^~~~~
a.cc:35:8: error: 'train' was not declared in this scope
35 | if (!train.empty()) {
| ^~~~~
a.cc:39:3: error: 'cout' was not declared in this scope
39 | cout << ans << endl;
| ^~~~
a.cc:39:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:39:18: error: 'endl' was not declared in this scope
39 | cout << ans << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #define rep(i,n) for (int i=0; i<(int)(n); i++)
|
s776093202 | p03785 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int N, C, K, T[100001], b_cnt=1, p_cnt=1, tmp=0;
cin >> N >> C >> K;
for(int i=0; i<N; i++){
cin >> T[i];
}
sort(T, T+N);
tnmp = T[0];
for(int i=1; i<N; i++){
if(tmp+K < T[i] || p_cnt >= C){
if(i != N-1) b_cnt++;
p_cnt=0;
tmp=T[i+1];
}else p_cnt++;
}
cout << b_cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:3: error: 'tnmp' was not declared in this scope; did you mean 'tmp'?
12 | tnmp = T[0];
| ^~~~
| tmp
|
s361999813 | p03785 | C++ | #include<iostream>
using namespace std;
int main(){
int N, C, K, T[100001], b_cnt=1, p_cnt=1, tmp=0;
cin >> N >> C >> K;
for(int i=0; i<N; i++){
cin >> T[i];
}
tmp = T[0];
sort(T, T+N);
for(int i=1; i<N; i++){
p_cnt++;
if(tmp+K < T[i] || p_cnt >= C){
b_cnt++;
p_cnt=1;
tmp=T[i+1];
}
}
cout << b_cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(T, T+N);
| ^~~~
| short
|
s833772483 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define all(vec) vec.begin(),vec.end()
int main() {
int N,C,K; cin >> N >> C >> K;
vector<int> T(N);
rep(i,N) cin >> T.at(i);
sort(all(T));
int bus = 1;
int psng = 0;
int bustime = T.at(0)+ K; //1台目の時間6
reo(i,N){
if (T.at(i) <= bustime && psng < C) psng++;
else{
bus++;
psng=1;
bustime = T.at(i) + K;
// cout << i+1 <<" bus " << bus << "-" << bustime << endl;
}
}
cout << bus << endl;
}
| a.cc: In function 'int main()':
a.cc:14:7: error: 'i' was not declared in this scope
14 | reo(i,N){
| ^
a.cc:14:3: error: 'reo' was not declared in this scope; did you mean 'rep'?
14 | reo(i,N){
| ^~~
| rep
|
s431604656 | p03785 | C++ | # include <iostream>
# include <vector>
# include <algorithm>
using namespace std;
# define ll long long
int main(){
int n, capacity, late;
cin >> n >> capacity >> late;
int time[100005];
for(int i=0; i<N; i++) cin >> time[i];
sort(time, time+N);
int ans = 1, currentCap = 1, firstPerson = time[0];
for(int i=1; i<n; i++){
if(currentCap + 1 <= capacity && time[i] <= firstPerson + late){
currentCap++;
} else {
ans++;
capacity = 1;
firstPerson = time[i];
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:18: error: 'N' was not declared in this scope
14 | for(int i=0; i<N; i++) cin >> time[i];
| ^
a.cc:15:19: error: 'N' was not declared in this scope
15 | sort(time, time+N);
| ^
|
s545825431 | p03785 | C++ | # include <iostream>
# include <vector>
# include <algorithm>
using namespace std;
# define ll long long
int main(){
int N, capacity, late;
cin >> N >> capacity >> late;
int time[100005];
for(int i=0; i<N; i++) cin >> time[i];
sort(time, time+N);
int ans = 1, currentCap = 1, firstPerson = time[0];
for(int i=1; i<n; i++){
if(currentCap + 1 <= capacity && time[i] <= firstPerson + late){
currentCap++;
} else {
ans++;
capacity = 1;
firstPerson = time[i];
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:18: error: 'n' was not declared in this scope
18 | for(int i=1; i<n; i++){
| ^
|
s915151852 | p03785 | C++ | #include <string>
#include <memory>
#include <vector>
#include <iostream>
#include <set>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(0);
cin.tie(0);
int n, c, k;
cin >> n >> c >> k;
std::vector<int> v(n);
for (auto& el : v) {
cin >> el;
}
sort(v.begin(), v.end());
int cur = v[0];
int cnt = 1;
int ans = 1;
for (int i = 1; i < n; i++) {
if (v[i] - cur <= k && cnt + 1 <= c) {
cnt++;
continue;
} else {
cur = v[i];
cnt = 1;
ans++;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:20:3: error: 'sort' was not declared in this scope; did you mean 'short'?
20 | sort(v.begin(), v.end());
| ^~~~
| short
|
s094267051 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,C,K;
cin >> N >> C >> K;
vector<int>data(N);
for(int i=0;i<N;i++){
cin >> data.at(i);
}
sort(data.begin(),data.end());
int count=0;
pair<int,int>start;
start.first=-1;
for(int i=0;i<N;i++){
if(start.first>=data.at(i)&&i-start.second<C){
}
else{
count ++;
startfirst=data.at(i);
start.second=i;
}
}
cout << count << endl;
}
| a.cc: In function 'int main()':
a.cc:20:7: error: 'startfirst' was not declared in this scope
20 | startfirst=data.at(i);
| ^~~~~~~~~~
|
s734563826 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,C,K;
cin >> N >> C >> K;
vector<int>data(N);
for(int i=0;i<N;i++){
cin >> data.at(i);
}
sort(data.begin(),data.end());
int count=0;
pair<int,int>start;
start.first=-1;
for(int i=0;i<N;i++){
if(start.first>=data.at(i)&&i-start.second<C){
}
else{
count ++;
pair.first=data.at(i);
pair.second=i;
}
}
cout << count << endl;
}
| a.cc: In function 'int main()':
a.cc:20:11: error: expected unqualified-id before '.' token
20 | pair.first=data.at(i);
| ^
a.cc:21:11: error: expected unqualified-id before '.' token
21 | pair.second=i;
| ^
|
s675075480 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,C,K;
cin >> N >> C >> K;
vector<int>data(N);
for(int i=0;i<N;i++){
cin >> data.at(i);
}
sort(data.begin(),data.end());
int count=0;
pair<int,int>start;
start.first=-1
for(int i=0;i<N;i++){
if(start.first>=data.at(i)&&i-start.second<C){
}
else{
count ++;
pair.first=data.at(i);
pair.second=i;
}
}
cout << count << endl;
} | a.cc: In function 'int main()':
a.cc:14:17: error: expected ';' before 'for'
14 | start.first=-1
| ^
| ;
15 | for(int i=0;i<N;i++){
| ~~~
a.cc:15:15: error: 'i' was not declared in this scope
15 | for(int i=0;i<N;i++){
| ^
|
s866251374 | p03785 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
int N,C,K;
cin >> N >> C >> K;
vector<int> T[N];
for(int i=0; i<N;++i)cin >> T[i];
sort(T.begin(),T.end());
int res=0,j;
for(int i=0;i<N;){
res++;
j=i;
while(i<N && T[i]-T[j] && i-j<C)i++;
}
cout << res << endl;
}
| a.cc: In function 'int main()':
a.cc:10:28: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>')
10 | for(int i=0; i<N;++i)cin >> T[i];
| ~~~ ^~ ~~~~
| | |
| | std::vector<int>
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}
352 | operator>>(__streambuf_type* __sb);
| ~~~~~~~~~~~~~~~~~~^~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base. |
s542365734 | p03785 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int N,C,K;
cin >> N >> C >> K;
int T[N];
for(int i=0; i<N;i++){
cin >> T[i];
}
sort(T,T+N);
reverse(T,T+N);
int j=0,count=0;
for(int i=0;i<N;i++){
if(-T[i]+T[j]<=K){
if(i==N-1 && j=0)count +=(N+C-1)/C;
else continue;
}
else {
count+=(i-j+C-1)/C;
j=i;
}
}
cout << count + 1 << endl;
}
| a.cc: In function 'int main()':
a.cc:17:17: error: lvalue required as left operand of assignment
17 | if(i==N-1 && j=0)count +=(N+C-1)/C;
| ~~~~~~~^~~~
|
s413834529 | p03785 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define SP <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> Graph;
//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定 変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//char('0'+cnt) 数字cntからcharへの変換
//int(char-'0') charからintへの変換
int main(){
int n;
ll c,k;
cin >> n >> c >> k;
vl t(n);
rep(i,n) cin >> t.at(i);
sort(all(t));
int ans = 1;
int now = 0;
rep(i,n){
if(now+c=i || t.at(now)+k < t.at(i)){
ans++;
now = i;
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:50:15: error: lvalue required as left operand of assignment
50 | if(now+c=i || t.at(now)+k < t.at(i)){
| ~~~^~
|
s453250073 | p03785 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define SP <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> Graph;
//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定 変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//char('0'+cnt) 数字cntからcharへの変換
//int(char-'0') charからintへの変換
int main(){
int n;
ll c,k;
cin >> n >> c >> k;
vl t(n);
rep(i,n) cin >> t.at(i);
sort(all(t));
int ans = 1;
int now = 0;
rep(i,n){
if(s+c=i || t.at(s)+k < t.at(i)){
ans++;
now = i;
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:50:12: error: 's' was not declared in this scope
50 | if(s+c=i || t.at(s)+k < t.at(i)){
| ^
|
s379121465 | p03785 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define SP <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> Graph;
//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定 変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//char('0'+cnt) 数字cntからcharへの変換
//int(char-'0') charからintへの変換
int main(){
int n;
ll c,k;
cin >> n > c >> k;
vl t(n);
rep(i,n) cin >> t.at(i);
sort(all(t));
int ret = 1;
int s = 0;
rep(i,n){
if(s+c<=i || t.at(s)+k < t.at(i)){
ret++;
s = i;
}
}
cout << ret << endl;
}
| a.cc: In function 'int main()':
a.cc:43:14: error: no match for 'operator>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'long long int')
43 | cin >> n > c >> k;
| ~~~~~~~~ ^ ~~~~~~
| | |
| | long long int
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:43:14: note: candidate: 'operator>(int, long long int)' (built-in)
43 | cin >> n > c >> k;
| ~~~~~~~~~^~~~~~~~
a.cc:43:14: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1329 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1497 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1673 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
43 | cin >> n > c >> k;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
43 | cin >> n > c >> k;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
43 | cin >> n > c >> k;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | cin >> n > c >> k;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:43:21: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int'
43 | cin >> n > c >> k;
| |
s823845276 | p03785 | C++ | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
int main() {
int n,c,k;
cin>>n>>c>>k;
vector<int> t(n);
rep(i,n) cin>>t[i];
sort(all(t));
/////////////
// wakarannnnnnnnnn/////
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:20:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
20 | cout<<ans<<endl;
| ^~~
| abs
|
s098335777 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
int main(void)
{
IOS
int N, C, K;
cin >> N >> C >> K;
vector<int> T(N);
REP(i,N) cin >> T[i];
sort(ALL(T));
int c = 0, time = 0;;
int ans = 0;
c = 1, time = t[0];
FOR(i,1,N) {
if (T[i] - time > K || c >= C) {
ans++;
c = 0;
}
if (c == 0) {
time = T[i];
c++;
} else {
c++;
}
}
ans++;
cout << ans << '\n';
return 0;
} | a.cc: In function 'int main()':
a.cc:28:19: error: 't' was not declared in this scope
28 | c = 1, time = t[0];
| ^
|
s191962362 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()
ll ts = 1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n, c, k;
cin >> n >> c >> k;
vector<ll> t(n);
REP(i, n) { cin >> t[i]; }
sort(all(t));
int ans = 0, nc, nk = -1;
for (int i = 0; i < n; i++) {
if (nk < a[i] || !nc) {
ans++;
nc = c - 1;
nk = t[i] + k;
} else {
nc--;
}
}
cout << ans << "\n";
}
| a.cc: In function 'int main()':
a.cc:28:14: error: 'a' was not declared in this scope
28 | if (nk < a[i] || !nc) {
| ^
|
s539989467 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()
ll ts = 1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n, c, k;
cin >> n >> c >> k;
vector<ll> t(n);
REP(i, n) { cin >> t[i]; }
sort(all(t));
int ans = 0, nc, nk = -1;
for (int i = 0; i < n; i++) {
if (nk < a[i] || !nc) {
ans++;
nc = c - 1;
nk = a[i] + k;
} else {
nc--;
}
}
cout << ans << "\n";
}
| a.cc: In function 'int main()':
a.cc:28:14: error: 'a' was not declared in this scope
28 | if (nk < a[i] || !nc) {
| ^
|
s923790795 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, C, K;
cin >> N >> C >> K;
int T[N];
for (int i = 0; i< N; i++) {
cin >> T[i];
}
sort(T, T + N);
int bus_count = 0;
int ninzu = 0;
int i = 0;
while(i < N) {
bus_count++;
bus_time = T[i] + K;
int j = i;
while (j < N && T[j] <= bus_time && ninzu <= C) {
j++;
ninzu++;
}
i = j;
}
cout << bus_count << endl;
} | a.cc: In function 'int main()':
a.cc:21:5: error: 'bus_time' was not declared in this scope
21 | bus_time = T[i] + K;
| ^~~~~~~~
|
s440783294 | p03785 | C++ | // include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
// func
// ------------------------------------------------
int CalcSumOfDigit(int n); // 各桁の和を計算する。
int getDigit(int n); // 数字の桁数を取得する。
string upper(string str); // 英字を大文字に変換する。
string lower(string str); // 英字を小文字に変換する。
// define
// ------------------------------------------------
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(a) int((a).size())
#define rep(i,n) for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n) for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v) sort((v).begin(),(v).end())
#define rvsort(v) sort(rall((v)))
#define vi vector<int>
#define GCD(a,b) __gcd((a),(b))
#define LCM(a,b) (a)/GCD((a),(b))*(b)
#define kiriage(a,b) ((a)+(b)-1)/(b)
const int INF = 1e9;
typedef long long ll;
typedef unsigned long long ull;
// code
// ------------------------------------------------
int main() {
int n,c,k;
cin >> n >> c >> k;
vector<ll> a(n);
vsort(a);
rep(i,n) cin >> a[i];
ll nb = -1;
ll ans = 0;
ll cus = 0;
for(int i = 0;i < n;)
{
nb = a[i] + k; // nb分には出発しないといけない
cus = 0; // 乗客が何人乗れるか?
ans++; // バスの数
for(int j = i;j < n;j++)
{
if(cus + 1<= c && a[j] <= nb)
{
cus++;
}
else
{
i = j; // j-1番目まで乗っている
cus=0; // バスはいってしまった &フラグ代わり
break;
}
}
if(cus != 0)
{
//バスが出たとき以外にここにくる。
break;
}
}
cout << ans << endl;
return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
int s = 0;
while(n)
{
s += n % 10;
n = n / 10;
}
return s;
return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(int n)
{
int i = 1;
while(1)
{
n = n / 10;
if(n == 1)
break;
i++;
}
return i;
}
int CalcSumOfDigit(int n)
{
int s = 0;
while(n)
{
s += n % 10;
n = n / 10;
}
return s;
}
string upper(string str)
{
for(auto itr = str.begin();itr != str.end() ; itr++)
{
if(97 <= *itr && *itr <= 122)
{
*itr = *itr - 32;
}
}
return str;
}
string lower(string str)
{
for(auto itr = str.begin();itr != str.end() ; itr++)
{
if(65 <= *itr && *itr <= 90)
{
*itr = *itr + 32;
}
}
return str;
}
| a.cc:111:5: error: redefinition of 'int CalcSumOfDigit(int)'
111 | int CalcSumOfDigit(int n)
| ^~~~~~~~~~~~~~
a.cc:83:5: note: 'int CalcSumOfDigit(int)' previously defined here
83 | int CalcSumOfDigit(int n)
| ^~~~~~~~~~~~~~
|
s418600739 | p03785 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N,C,K;
cin>>N>>C>>K;
vector<int> T(N);
for(int i=0; i<N; i++)
cin>>T[i];
int bus=0;
int passenger=0;
int first_wait;
sort(T.begin(), T.end());
for(int i=0; i<N;) {
passenger=1;
first_wait=T[i++];
while(i<N && passenger<C && T[i]-first_wait<=K) {
passenger++;
i++;
}
bus++;
}
cout<<bus<<endl;
} | a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
15 | sort(T.begin(), T.end());
| ^~~~
| short
|
s285702781 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;
ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
int main(){
ll n, c, k;
cin >> n >> c >> k;
vector<ll> t(n);
rep(i, n) cin >> t[i];
sort(t.begin(), t.end());
ll ans = 0;
ll th = INF;
l tmpc = c;
for(int i = 0; i < n; ++i){
th = min(th, t[i] + k);
tmpc--;
if(th < t[i]){
tmpc = c - 1;
ans++;
th = t[i] + k;
}
else if(tmpc == 0){
tmpc = c;
ans++;
th = INF;
}
}
ans++;
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:21:9: error: 'l' was not declared in this scope
21 | l tmpc = c;
| ^
a.cc:24:17: error: 'tmpc' was not declared in this scope; did you mean 'tm'?
24 | tmpc--;
| ^~~~
| tm
|
s970470710 | p03785 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void){
int n,c,k;
cin >> n >> c >> k;
vector<int> vec(n);
for(int i=0;i<n;i++) cin >> vec.at(i);
int bus=0,people=0;
for(int i=0;i<n;){
if(i==n-1){bus++; break;} //最終乗客=第一乗客のときは専用バスあげて終了
int p0 = vec.at(i); //第一乗客の時刻
while(vec.at(i)-p0<=k && people<c){
if(i==n-1) break;
people++; //人乗せる
i++; //時間送る
}
bus++;
people = 0;
} | a.cc: In function 'int main()':
a.cc:22:6: error: expected '}' at end of input
22 | }
| ^
a.cc:4:15: note: to match this '{'
4 | int main(void){
| ^
|
s367809073 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n,c,k,count=0;
cin >> n >> c >> k;
long long C=c;
vector<int>t(n);
for(int i=0; i<n; i++) cin >> t[i];
sort(t.begin(),t.end());
for(int i=0; i<n; i++){
t[i]+=k;
C--;
for(int j=i+1; j<n; j++){
if(t[j]>[i]){
i=j;
C=c;
break;
}
C--;
if(C==0){
i=j;
C=c;
break;
}
}
count++;
}
cout << count << endl;
}
| a.cc: In lambda function:
a.cc:17:18: error: expected '{' before ')' token
17 | if(t[j]>[i]){
| ^
a.cc: In function 'int main()':
a.cc:17:14: error: no match for 'operator>' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'main()::<lambda()>')
17 | if(t[j]>[i]){
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1329 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1497 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1673 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
17 | if(t[j]>[i]){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:17:18: note: 'main()::<lambda()>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
17 | if(t[j]>[i]){
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: temp |
s271035275 | p03785 | C++ | #include<iostream>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n,c,k,people,sign,bus;
int timer[100010];
int main()
{
cin>>n>>c>>k;
for(int i=1; i<=n; i++)
scanf("%d",&timer[i]);
sort(timer+1,timer+1+n);
people=1;
bus=1;
sign=timer[1]+k;
for(int i=2; i<=n; i++)
if(sign<timer[i]||sum==c)
{
bus++;
people=1;
sign=timer[i]+k;
}
else people++;
cout<<bus<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:35: error: 'sum' was not declared in this scope
19 | if(sign<timer[i]||sum==c)
| ^~~
|
s097658605 | p03785 | C++ | #include<iostream>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namestiace std;
int n,k,c,t[100010];
int per=1,cnt=1,tb;
int main()
{
scanf("%d%d%d",&n,&c,&k);
for(int i=1;i<=n;i++)
{
scanf("%d",&t[i]);
}
sort(t+1,t+1+n);
tb=t[1]+k;
for(int i=2;i<=n;i++)
{
if(t[i]>tb||per==c){
cnt++;
tb=t[i]+k;
per=1;
}
else per++;
}
printf("%d",cnt);
return 0;
} | a.cc:6:7: error: expected nested-name-specifier before 'namestiace'
6 | using namestiace std;
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
16 | sort(t+1,t+1+n);
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:5:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
|
s848300884 | p03785 | C++ | #include<iostream>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namestiace std;
int n,k,c,t[100010];
int per=1,cnt=1,tb;
int main()
{
scanf("%d%d%d",&n,&c,&k);
for(int i=1;i<=n;i++)
{
scanf("%d",&t[i]);
}
sort(t+1,t+n+1);
tb=t[1]+k;
for(int i=2;i<=n;i++)
{
if(t[i]>tb||per==c){
cnt++;
tb=t[i]+k;
per=1;
}
else per++;
}
printf("%d",cnt);
return 0;
} | a.cc:6:7: error: expected nested-name-specifier before 'namestiace'
6 | using namestiace std;
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
16 | sort(t+1,t+n+1);
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:5:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
|
s868003060 | p03785 | C++ | #include <bits/stdc++.h>
using namestiace std;
int n,k,c,t[100010];
int per=1,cnt=1,tb;
int main(){
scanf("%d%d%d",&n,&c,&k);
for(int i=1;i<=n;i++){
scanf("%d",&t[i]);
}
sort(t+1,t+n+1);
tb=t[1]+k;
for(int i=2;i<=n;i++){
if(t[i]>tb||per==c){
cnt++;
tb=t[i]+k;
per=1;
}
else per++;
}
printf("%d",cnt);
return 0;
} | a.cc:3:7: error: expected nested-name-specifier before 'namestiace'
3 | using namestiace std;
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
13 | sort(t+1,t+n+1);
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
|
s982670636 | p03785 | C++ | #include<iostream>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n,c,k,ans,sign,sum;
int time[100010];
int main()
{
cin>>n>>c>>k;
for(int i=1; i<=n; i++)
scanf("%d",&time[i]);
sort(time+1,time+1+n);
sum=1;
ans=1;
sign=time[1];
for(int i=2; i<=n; i++)
if(sign+c>time[i]||sum==k)
{
ans++;
sum=1;
sign=time[i];
}
else sum++;
cout<<ans<<endl;
return 0;
} | a.cc:8:16: error: 'int time [100010]' redeclared as different kind of entity
8 | int time[100010];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:13:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | scanf("%d",&time[i]);
| ^
a.cc:14:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
14 | sort(time+1,time+1+n);
| ~~~~^~
a.cc:14:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
14 | sort(time+1,time+1+n);
| ~~~~^~
a.cc:14:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
14 | sort(time+1,time+1+n);
| ~~~~~~^~
a.cc:17:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
17 | sign=time[1];
| ^
a.cc:17:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
17 | sign=time[1];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:19:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | if(sign+c>time[i]||sum==k)
| ^
a.cc:19:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
19 | if(sign+c>time[i]||sum==k)
| ~~~~~~^~~~~~~~
a.cc:23:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | sign=time[i];
| ^
a.cc:23:36: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
23 | sign=time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long int (*)(long int*) noexcept; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long int (*)(long int*) noexcept]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:6: required from here
14 | sort(time+1,time+1+n);
| ~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: ISO C++ forbids using pointer to a function in subtraction [-fpermissive]
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
|
s909053471 | p03785 | C++ | #include<iostream>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<string.h>
#include<algorithm>
#include<iomanip>
using namespace std;
int n,c,k,ans,sign,sum;
int time[100010];
int main()
{
cin>>n>>c>>k;
for(int i=1; i<=n; i++)
scanf("%d",&time[i]);
sort(time+1,time+1+n);
sum=1;
ans=1;
sign=time[1];
for(int i=2; i<=n; i++)
if(sign+c>time[i]||sum>k)
{
ans++;
sum=1;
sign=time[i];
}
else sum++;
cout<<ans<<endl;
return 0;
} | a.cc:13:16: error: 'int time [100010]' redeclared as different kind of entity
13 | int time[100010];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:18:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
18 | scanf("%d",&time[i]);
| ^
a.cc:19:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | sort(time+1,time+1+n);
| ~~~~^~
a.cc:19:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | sort(time+1,time+1+n);
| ~~~~^~
a.cc:19:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | sort(time+1,time+1+n);
| ~~~~~~^~
a.cc:22:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
22 | sign=time[1];
| ^
a.cc:22:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
22 | sign=time[1];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:24:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | if(sign+c>time[i]||sum>k)
| ^
a.cc:24:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
24 | if(sign+c>time[i]||sum>k)
| ~~~~~~^~~~~~~~
a.cc:28:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
28 | sign=time[i];
| ^
a.cc:28:36: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
28 | sign=time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:9:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long int (*)(long int*) noexcept; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long int (*)(long int*) noexcept]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:19:6: required from here
19 | sort(time+1,time+1+n);
| ~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: ISO C++ forbids using pointer to a function in subtraction [-fpermissive]
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
|
s241647925 | p03785 | C++ | #include<iostream>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<string.h>
#include<algorithm>
#include<iomanip>
using namespace std;
int n,c,k,ans,sign,sum;
int time[100010];
int main()
{
cin>>n>>c>>k;
for(int i=1; i<=n; i++)
scanf("%d",&time[i]);
sort(time+1,time+1+n);
sum=1;
ans=1;
sign=time[1];
for(int i=2; i<=n; i++)
if(sign+c>time[i]||sum>k)
{
ans++;
sum=1;
sign=time[i];
}
else sum++;
cout<<ans<<endl;
return 0;
} | a.cc:13:16: error: 'int time [100010]' redeclared as different kind of entity
13 | int time[100010];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:18:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
18 | scanf("%d",&time[i]);
| ^
a.cc:19:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | sort(time+1,time+1+n);
| ~~~~^~
a.cc:19:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | sort(time+1,time+1+n);
| ~~~~^~
a.cc:19:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | sort(time+1,time+1+n);
| ~~~~~~^~
a.cc:22:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
22 | sign=time[1];
| ^
a.cc:22:20: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
22 | sign=time[1];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:24:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | if(sign+c>time[i]||sum>k)
| ^
a.cc:24:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
24 | if(sign+c>time[i]||sum>k)
| ~~~~~~^~~~~~~~
a.cc:28:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
28 | sign=time[i];
| ^
a.cc:28:36: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
28 | sign=time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:9:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long int (*)(long int*) noexcept; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long int (*)(long int*) noexcept]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:19:6: required from here
19 | sort(time+1,time+1+n);
| ~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: ISO C++ forbids using pointer to a function in subtraction [-fpermissive]
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
|
s741601834 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,C,K,S=0;cin>>N>>C>>K;
vector<int>T(N);
for(int i=0;i<N;i++)cin>>T.at(i):
sort(T.begin(),T.end());
for(int i=0;i<N;i++){
S++;int j=1;
while(j<C&&T.at(i)+C>=T.at(i+j))j++;
i+=j-1;
}
cout<<S<<endl;
} | a.cc: In function 'int main()':
a.cc:6:35: error: expected ';' before ':' token
6 | for(int i=0;i<N;i++)cin>>T.at(i):
| ^
| ;
|
s364842134 | p03785 | C++ | //WAだけどどこが間違っているのかわからないので後日のために投げときます
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,C,K;
cin >>N >> C >> K;
int t[i];
for (int i=0;i<N;i++){
cin>>t[i];
}
sort(t,t+N);
vector <int> b;
int num=0;
b[num]=t[0];
int nowbus=1;
for (int i=1;i<N;i++){
cout<<i<<" "<<num<<" "<<nowbus<<endl;
if((t[i]<=b[num]+K)&&(C-nowbus>=0)){//時間内 まだ乗れる
nowbus++;
}
else if(t[i]>b[num]+K){//K秒以上経過して到着
nowbus=1;
num++;
b[num]=t[i];
}
else if(C-nowbus<0){
nowbus=1;
num++;
b[num]=t[i];
}
}
cout<<num+1<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:9: error: 'i' was not declared in this scope
9 | int t[i];
| ^
a.cc:11:10: error: 't' was not declared in this scope
11 | cin>>t[i];
| ^
a.cc:13:8: error: 't' was not declared in this scope
13 | sort(t,t+N);
| ^
|
s891130443 | p03785 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, C, K;
cin >> N >> C >> K;
int Bus = 0;
int Waiting = 0;
int AngryTime = INFINITY;
vector<int> Schedule(N, 0);
for (int i = 0; i < N; i++) cin >> Schedule[i];
sort(Schedule.begin(), Schedule.end());
for (int i = 0; i < N; i++) {
int T = Schedule[i];
Waiting++;
if (AngryTime >= T) {
Bus++;
Waiting = 1;
}
if (Waiting == C) {
Bus++;
Waiting = 0;
}
if (Waiting == 1) {
AngryTime = T + K;
}
}
cout << Bus;
} | a.cc: In function 'int main()':
a.cc:12:25: error: 'INFINITY' was not declared in this scope
12 | int AngryTime = INFINITY;
| ^~~~~~~~
|
s298983008 | p03785 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long int N,C,K;
long int ans = 0;
cin >> N >> C >> K;
vector<int> T(N);
long int count = 1;
for(int i = 0; i < N; i++) {cin >> T[i];}
sort(T.begin(),T.end());
long int tt = -1;
long int cnt = 0;
for(int i = 1; i < N; i++){
if(T[i] <= tt && cnt + 1 <=C){
cnt++;
}else{
ans++;
tt = T[i] + K;
cnt = 1;
}
}
}
cout << ans;
} | a.cc:31:2: error: 'cout' does not name a type
31 | cout << ans;
| ^~~~
a.cc:35:1: error: expected declaration before '}' token
35 | }
| ^
|
s745318693 | p03785 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long int N,C,K;
long int ans = 0;
cin >> N >> C >> K;
vector<int> T(N);
long int count = 1;
for(int i = 0; i < N; i++) {cin >> T[i];}
sort(T.begin(),T.end());
long int tt = -1;
long int cnt = 0;
for(int i = 1; i < N; i++){
if(t[i] <= tt && cnt + 1 <=c){
cnt++;
}else{
ans++;
tt = T[i] + K;
cnt = 1;
}
}
}
cout << ans;
} | a.cc: In function 'int main()':
a.cc:20:7: error: 't' was not declared in this scope
20 | if(t[i] <= tt && cnt + 1 <=c){
| ^
a.cc:20:31: error: 'c' was not declared in this scope
20 | if(t[i] <= tt && cnt + 1 <=c){
| ^
a.cc: At global scope:
a.cc:31:2: error: 'cout' does not name a type
31 | cout << ans;
| ^~~~
a.cc:35:1: error: expected declaration before '}' token
35 | }
| ^
|
s328395377 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 100005;
int n, c, k;
int a[Maxn];
int res;
int main()
{
scanf("%d %d %d", &n, &c, &k);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
sort(a, a + n);
int pnt = 0;
while (pnt < n) {
res++;
pnt = min(upper_bound(a, a + n, a[pnt] + k) - a, pnt + c);
}
printf("%d\n", res);
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:18: error: no matching function for call to 'min(long int, int)'
19 | pnt = min(upper_bound(a, a + n, a[pnt] + k) - a, pnt + c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
19 | pnt = min(upper_bound(a, a + n, a[pnt] + k) - a, pnt + c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
19 | pnt = min(upper_bound(a, a + n, a[pnt] + k) - a, pnt + c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s515318366 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 100005;
int n, c, k;
int a[Maxn];
int res;
int main()
{
scanf("%d %d %d", &n, &c, &k);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
sort(a, a + n);
int pnt = 0;
while (pnt < n) {
res++;
pnt = min(upper_bound(a, a + n, a[pnt] + k) - a, pnt + c);
}
printf("%d\n", res);
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:18: error: no matching function for call to 'min(long int, int)'
19 | pnt = min(upper_bound(a, a + n, a[pnt] + k) - a, pnt + c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
19 | pnt = min(upper_bound(a, a + n, a[pnt] + k) - a, pnt + c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
19 | pnt = min(upper_bound(a, a + n, a[pnt] + k) - a, pnt + c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s136333350 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!
int main() {
int n, c, k;
cin >> n >> c >> k;
int t[n];
for (int i = 0; i < n; i++) cin >> t[i];
sort(t, t+n);
ll dep = t[0] + k, cnt = 0, ans = 1;
for (int i = 0; i < n; i++) {
if (dep < t || cnt == c) {
dep = t[i] + k, cnt = 0, ans++;
}
cnt++;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:15:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
15 | if (dep < t || cnt == c) {
| ~~~~^~~
|
s149134077 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
long int c, k;
cin >> c >> k;
vector<long int> t(n);
for(int i = 0; i < n; i++){
cin >> t.at(i);
}
sort(t.begin(). t.end());
int rag = k;
int count = 0;
int bus = 0;
for(int i = 0; i < n; i++){
if(count == c){
rag = k;
count = 0;
bus++;
}
if(rag == k){
rag += t.at(i);
bus++;
count++;
}else if(t.at(i) < rag){
count++;
}else if(t.at(i) > rag){
count = 0;
rag = k;
}
}
cout << bus;
} | a.cc: In function 'int main()':
a.cc:13:19: error: 'std::vector<long int>::iterator' has no member named 't'
13 | sort(t.begin(). t.end());
| ^
|
s748082016 | p03785 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
long long int n,c,k;
cin >> n >> c >> k;
vector<long long int> list(n);
for (long long int i=0;i<n;i++) {
cin >> list.at(i);
}
revers(list.begin(), list.end());
long long int count=1,temp_time=list.at(0),temp_num=0;
for (int i=0;i<n;i++) {
temp_num++;
if (temp_num>c||list.at(i)-temp_time>k) {
count++;
temp_num=1;
temp_time=list.at(i);
}
}
cout << count << endl;
| a.cc: In function 'int main()':
a.cc:11:3: error: 'revers' was not declared in this scope
11 | revers(list.begin(), list.end());
| ^~~~~~
a.cc:22:25: error: expected '}' at end of input
22 | cout << count << endl;
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s386972485 | p03785 | C++ | //Zory-2019
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
typedef long long ll;
#define pii pair<int,int>
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define GG(x) if(x) {puts("error");exit(666);}
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
ll qread()
{
ll ans=0,f=1;char c=getchar();
while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
return ans*f;
}
void write(ll num)
{
if(num<0) putchar('-'),num=-num;
if(num>=10) write(num/10);
putchar('0'+num%10);
}
void write1(ll num){write(num);putchar(' ');}
void write2(ll num){write(num);putchar('\n');}
template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;
int mm(const int x){return x>=MOD?x-MOD:x;}
template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
ll qpower(ll x,ll e,int mod=MOD){ll ans=1;GG(e<0)while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
ll invm(ll x){return qpower(x,MOD-2);}
const int N=2e5+10;
pii a[N];priority_queue< int,vc<int>,greater<int> > q;
void main()
{
int n=qread(),C=qread(),K=qread();
fo(i,1,n) a[i].FR=qread(),a[i].SE=a[i].FR+K;sort(a+1,a+n+1);
int ans=0;a[n+1].FR=INF+INF;
fo(i,1,n+1)9
{
while(sz(q) and q.top()<a[i].FR)
{
int cnt=C;while(cnt-- and sz(q)) q.pop();
ans++;
}q.push(a[i].SE);
}write(ans);
}
};//(ans+MOD)%MOD
signed main()
{
srand(time(0));
mine::main();
}
| a.cc: In function 'void mine::main()':
a.cc:52:29: error: expected ';' before '{' token
52 | fo(i,1,n+1)9
| ^
| ;
53 | {
| ~
|
s687449675 | p03785 | C++ | //スギノキさんの写経コード
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b) for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n) For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x) cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
//グラフ用
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//ここから書き始める
ll combination(ll n, ll i){
ll count = 0;
ll multi = 1;
ll div =1;
int limit = i;
while(count < limit){
multi *= n;
n--;
multi/= count+1;
count ++ ;
}
return multi / div;
}
int main()
{
cout <<setprecision(10);
int N , C , K ;
cin >> N >> C >> K ;
vector<int> T(N);
rep(i,N) cin >> T[i];
SORT(T);
int bus = 1;
int count = 0; //乗客数カウント
int time = 0 ;//一人目の客の乗車時刻
for(int i = 0 ; i < N ; i++){
if(count == c){
bus ++ ;
count = 0;
}
if(count == 0){
time = T.at(i);
count ++ ;
}else{
if( T.at(i) <= time + K) count ++;
else{
bus ++ ;
count = 1;
time = T.at(i);
}
}
}
cout << bus << endl;
}
| a.cc: In function 'bool coY()':
a.cc:20:32: warning: no return statement in function returning non-void [-Wreturn-type]
20 | bool coY() {cout <<"Yes"<<endl;}
| ^
a.cc: In function 'bool coN()':
a.cc:21:30: warning: no return statement in function returning non-void [-Wreturn-type]
21 | bool coN(){cout <<"No"<<endl;}
| ^
a.cc: In function 'int main()':
a.cc:65:29: error: 'c' was not declared in this scope
65 | if(count == c){
| ^
|
s282192981 | p03785 | C++ | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int N, C, K;
cin >> N >> C >> K;
vector<int> T(N);
for( int i = 0; i < N; i++ ) cin >> T.at(i);
sort( T.begin(), T.end() );
int bus = 1;
int count = 0; //乗客数カウント
int time = 0; //1人目の客の乗車時刻
for( int i = 0; i < N; i++ ){
if( count == 0 ){
time = T.at(i);
count++;
}else{
if( T.at(i) <= time + K ) count++;
else{
bus++;
count = 1;
if(i+1>=n)break;
time = T.at(i+1);
}
}
if( count == C ){
bus++;
count = 0;
}
}
cout << bus << endl;
}
| a.cc: In function 'int main()':
a.cc:25:17: error: 'n' was not declared in this scope
25 | if(i+1>=n)break;
| ^
|
s836272580 | p03785 | C++ | #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i, n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);
int main() {
ll n,c,k;
cin>>n>>c>>k;
vector<ll> t(n);
rep(i,n){cin>>t[i];t[i]+=c; }
sort(t.begin(),t.end());
ll ans = 0;
ll no = 0;
ll ma = 0;
for(int i=0;i<n;i++){
if(no==0){
ma=t[i];
ans++;
no++;
}else if(t[i]-c<=ma&&no<k){
no++;
}else{
no=0;
i--;
}
}
if(no!=0)ans++;
cout<<ans<<endl;
return 0;
}
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i, n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);
int main() {
ll n,c,k;
cin>>n>>c>>k;
vector<ll> t(n);
rep(i,n){cin>>t[i];t[i]+=c; }
sort(t.begin(),t.end());
ll ans = 0;
ll no = 0;
ll ma = 0;
for(int i=0;i<n;i++){
if(no==0){
ma=t[i];
ans++;
no++;
}else if(t[i]-c<=ma&&no<k){
no++;
}else{
no=0;
i--;
}
}
if(no!=0)ans++;
cout<<ans<<endl;
return 0;
}
| a.cc:76:5: error: redefinition of 'int dx [4]'
76 | int dx[4] = {1, 0, -1, 0};
| ^~
a.cc:21:5: note: 'int dx [4]' previously defined here
21 | int dx[4] = {1, 0, -1, 0};
| ^~
a.cc:77:5: error: redefinition of 'int dy [4]'
77 | int dy[4] = {0, 1, 0, -1};
| ^~
a.cc:22:5: note: 'int dy [4]' previously defined here
22 | int dy[4] = {0, 1, 0, -1};
| ^~
a.cc:78:10: error: redefinition of 'const ll MOD'
78 | const ll MOD = 1e9 + 7;
| ^~~
a.cc:23:10: note: 'const ll MOD' previously defined here
23 | const ll MOD = 1e9 + 7;
| ^~~
a.cc:79:18: error: redefinition of 'const int MAX'
79 | static const int MAX = 100;
| ^~~
a.cc:24:18: note: 'const int MAX' previously defined here
24 | static const int MAX = 100;
| ^~~
a.cc:80:18: error: redefinition of 'const int INF'
80 | static const int INF = (1 << 23);
| ^~~
a.cc:25:18: note: 'const int INF' previously defined here
25 | static const int INF = (1 << 23);
| ^~~
a.cc:82:5: error: redefinition of 'int main()'
82 | int main() {
| ^~~~
a.cc:27:5: note: 'int main()' previously defined here
27 | int main() {
| ^~~~
|
s746678257 | p03785 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
cosnt int MAXN = 1e5 + 10;
int n, k, c;
int t[MAXN];
int main(){
cin >> n >> c >> k;
for(int i = 0; i < n; i++)
cin >> t[i];
sort(t, t + n);
int cc = c, tt = k, b = 0;
for(int i = 1; i <= n; i++){
if(cc < c && tt + t[i] - t[i - 1] <= k) {
cc++;
tt += t[i] - t[i - 1];
}
else {
b++;
cc = 1;
tt = 0;
}
}
cout << b << '\n';
return 0;
}
| a.cc:5:1: error: 'cosnt' does not name a type; did you mean 'const'?
5 | cosnt int MAXN = 1e5 + 10;
| ^~~~~
| const
a.cc:8:7: error: 'MAXN' was not declared in this scope
8 | int t[MAXN];
| ^~~~
a.cc: In function 'int main()':
a.cc:14:24: error: 't' was not declared in this scope
14 | cin >> t[i];
| ^
a.cc:16:14: error: 't' was not declared in this scope; did you mean 'tm'?
16 | sort(t, t + n);
| ^
| tm
|
s727129990 | p03785 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
cosnt int MAXN = 1e5 + 10;
int n, k, c;
int t[MAXN];
int main(){
cin >> n >> c >> k;
for(int i = 0; i < n; i++)
cin >> t[i];
sort(t, t + n);
int cc = c, tt = k, b = 0;
for(int i = 1; i <= n; i++){
if(cc < c && tt + t[i] - t[i - 1] <= k) {
cc++;
tt += t[i] - T[i - 1];
}
else {
b++;
c = 1;
t = 0;
}
}
cout << b << '\n';
return 0;
}
| a.cc:5:1: error: 'cosnt' does not name a type; did you mean 'const'?
5 | cosnt int MAXN = 1e5 + 10;
| ^~~~~
| const
a.cc:8:7: error: 'MAXN' was not declared in this scope
8 | int t[MAXN];
| ^~~~
a.cc: In function 'int main()':
a.cc:14:24: error: 't' was not declared in this scope
14 | cin >> t[i];
| ^
a.cc:16:14: error: 't' was not declared in this scope; did you mean 'tm'?
16 | sort(t, t + n);
| ^
| tm
a.cc:23:38: error: 'T' was not declared in this scope
23 | tt += t[i] - T[i - 1];
| ^
|
s319193876 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll INF = 1e10;
int main()
{
ll n, c, k;
cin >> n >> c >> k;
vector<int> t(n);
for(int i = 0; i < n; i++) cin >> t[i];
sort(t.begin(), t.end());
queue<int> que;
que.push(t[0]);
ll ans = 0;
for(int i = 1; i < n; i++)
{
ll now = t[i];
while(que.size() && que.front() + k <= now)
{
ll loop = min(int(que.size()), c);
while(loop--) que.pop();
ans++;
}
que.push(now);
}
ans += (que.size()-1)/c + 1;
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:21:26: error: no matching function for call to 'min(int, ll&)'
21 | ll loop = min(int(que.size()), c);
| ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:21:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
21 | ll loop = min(int(que.size()), c);
| ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:21:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
21 | ll loop = min(int(que.size()), c);
| ~~~^~~~~~~~~~~~~~~~~~~~
|
s303063696 | p03785 | C++ | #include <iostream>
using namespace std;
int main(){
int N, C, K;
cin >> N >> C >> K;
int T[N];
for (int i = 0; i < N; i++){
cin >> T[i];
}
sort(T,T + N);
int ans = 0, c = 0, k = 0;
bool dprt;
for (int i = 0; i < N - 1; i++){
c++;
k += T[i + 1] - T[i];
dprt = false;
if (c == C or k >= K){
c = 0;
k = 0;
ans++;
dprt = true;
}
}
if (dprt){ // last person calculations
ans++;
} else if (k + (T[N - 1] - T[N - 2]) >= K) {
ans++;
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort(T,T + N);
| ^~~~
| short
|
s837744396 | p03785 | C++ | #include <iostream>
using namespace std;
int N, C, K; //passengers, bus capacity, time capacity;
int* T;
int main()
{
cin >> N >> C >> K;
T = new int[N+1];
for(int i = 1; i <= N; i++) cin >> T[i];
sort(T+1, T+N+1);
int c = C, t = K, b = 0;
for(int i = 1; i <= N; i++)
{
if(c < C && t + T[i] - T[i-1] <= K)
{
c++;
t += T[i] - T[i-1];
continue;
}
b++;
c = 1;
t = 0;
}
cout << b << '\n';
return 0;
} | a.cc: In function 'int main()':
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(T+1, T+N+1);
| ^~~~
| short
|
s285838379 | p03785 | C++ | include<bits/stdc++.h>
using namespace std;
int main() {
int n = 0, c = 0, k = 0;
int a[10000000];
cin >> n >> c >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
cout << a[n-1];
int ans = 1, base = 0;
int passenger = 0;
int p = 0;
while (p != n){
if (passenger < c && (a[p] - a[base] <= k)){
p++;
passenger++;
} else {
ans++;
base = p;
p++;
passenger = 1;
}
}
cout << ans << endl;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
7 | cin >> n >> c >> k;
| ^~~
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(a, a + n);
| ^~~~
| short
a.cc:12:5: error: 'cout' was not declared in this scope
12 | cout << a[n-1];
| ^~~~
a.cc:27:20: error: 'endl' was not declared in this scope
27 | cout << ans << endl;
| ^~~~
|
s310531934 | p03785 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
template<typename T>void chmax(T &a,T b){a=max(a,b);}
template<typename T>void chmin(T &a,T b){a=min(a,b);}
using namespace std;
void solve(){
int n;
ll c,k;
cin>>n>>c>>k;
vector<ll>t(n);
rep(i,n){
cin>>t[i];
}
sort(t.begin(),t.end());
ll now=0;
while(now<n){
ll nxt=now;
while(nxt<n&&nxt-now<c&&t[nxt]-t[now]<=k)++nxt;
++ans;
now=nxt;
}
cout<<ans<<endl;
}
signed main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:40:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
40 | ++ans;
| ^~~
| abs
a.cc:43:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
43 | cout<<ans<<endl;
| ^~~
| abs
|
s981205646 | p03785 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
template<typename T>void chmax(T &a,T b){a=max(a,b);}
template<typename T>void chmin(T &a,T b){a=min(a,b);}
using namespace std;
void solve(){
int n;
ll c,k;
cin>>n>>c>>k;
vector<ll>t(n);
ll minv=1e9+5,maxv=0;
rep(i,n){
cin>>t[i];
minv=min(minv,t[i]);
maxv=max(maxv,t[i]);
}
sort(t.begin(),t.end());
ll now=0;
while(now<n){
ll nxt=cnt;
while(nxt<n&&nxt-now<c&&t[nxt]-t[cnt]<=k)++nxt;
++ans;
now=nxt;
}
cout<<ans<<endl;
}
signed main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:41:24: error: 'cnt' was not declared in this scope; did you mean 'int'?
41 | ll nxt=cnt;
| ^~~
| int
a.cc:43:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
43 | ++ans;
| ^~~
| abs
a.cc:46:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
46 | cout<<ans<<endl;
| ^~~
| abs
|
s905750213 | p03785 | C++ | #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long
void solve() {
int n, c, k; cin >> n >> c >> k;
int t[100100];
set<int> s;
int ans = 0;
rep(i, n) {
cin >> t[i];
if(t[i] > *s.begin()) {
ans ++;
if(s.size() <= c) {
s.clear();
} else {
s.erase(s.begin(), s.begin() + c);
}
}
s.insert(t[i] + k);
}
cout << ans << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
//cout << fixed << setprecision(10);
//init();
solve();
//cout << "finish" << endl;
return 0;
} | a.cc: In function 'void solve()':
a.cc:61:46: error: no match for 'operator+' (operand types are 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} and 'int')
61 | s.erase(s.begin(), s.begin() + c);
| ~~~~~~~~~ ^ ~
| | |
| | int
| std::set<int>::iterator {aka std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator}
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
61 | s.erase(s.begin(), s.begin() + c);
| ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: mismatched types 'const _CharT*' and 'std::_Rb_tree_const_iterator<int>'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: mismatched types 'const _CharT*' and 'std::_Rb_tree_const_iterator<int>'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:61:48: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
61 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, |
s789313434 | p03785 | C++ | #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long
void solve() {
int n, c, k; cin >> n >> c >> k;
int t[100100];
set<int> s;
int ans = 0;
rep(i, n) {
cin >> t[i];
s.insert(t[i] + k);
if(t[i] >= *s.begin()) {
ans ++;
if(s.size() <= c) {
s.erase(all(s));
} else {
s.erase(s.begin(), s.begin() + c);
}
}
}
cout << ans << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
//cout << fixed << setprecision(10);
//init();
solve();
//cout << "finish" << endl;
return 0;
} | a.cc: In function 'void solve()':
a.cc:62:46: error: no match for 'operator+' (operand types are 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} and 'int')
62 | s.erase(s.begin(), s.begin() + c);
| ~~~~~~~~~ ^ ~
| | |
| | int
| std::set<int>::iterator {aka std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator}
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
62 | s.erase(s.begin(), s.begin() + c);
| ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: mismatched types 'const _CharT*' and 'std::_Rb_tree_const_iterator<int>'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: mismatched types 'const _CharT*' and 'std::_Rb_tree_const_iterator<int>'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:62:48: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
62 | s.erase(s.begin(), s.begin() + c);
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, |
s414675051 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, C, K;
cin >> N >> C >> K;
vector<int> T(N);
for(int i = 0; i < N; i++){
cin >> T[i];
}
sort(T.begin(),T.end());
while(i < N){
int j = i;
while(i - j < C && i < N && T[i] <= T[j] + K){
i++;
}
ans++;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:12:11: error: 'i' was not declared in this scope
12 | while(i < N){
| ^
a.cc:17:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | ans++;
| ^~~
| abs
a.cc:20:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
20 | cout << ans << endl;
| ^~~
| abs
|
s696822557 | p03785 | C++ | #include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
//#include <map>
#include <algorithm>
using namespace std;
#define n_max 100000
#define N_max 100
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i > n; i--)
#define lrep(i, a, n) for(long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
int main()
{
int N, C, K;
vector<int> T;
cin >> N >> C >> K;
for(int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
T.push_back(tmp);
}
sort(T.begin(), T.end());
int bus = 0;
int i = N-1;
while(i > 0) {
int max_time = T.at(i) - K;
int person = 1;
for(int j = i; i > 0; i--) {
if(max_time > T.at(i)) {break;}
person++;
all+= person;
}
bus += (person / C);
if((person % C) != 0) { bus++; }
}
cout << bus << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:41:13: error: 'all' was not declared in this scope
41 | all+= person;
| ^~~
|
s859547631 | p03785 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main(){
int n,c,k;
cin>>n>>c>>k;
int t[n];
REP(i,n){
cin>>t[i];
}
int limit=t[0]+k;
int index=0;
int cnt=0;
while(index<n){
if(t[index]<=limit && cnt<c){
index++;
cnt++;
continue;
}else{
ans++;
limit = t[index]+k;
cnt = 0;
index++;
}
}
ans++;
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:105:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
105 | ans++;
| ^~~
| abs
a.cc:111:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
111 | ans++;
| ^~~
| abs
|
s009884270 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long n, c, k; cin >> n >> c >> k;
long a[n];
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a+n);
int ran = 0, cnt = 0;
for (int i = 0, i < n; i++) {
if (a[i] - a[ran] > k||i-ran+1>c) {
ran = i;
cnt++;
}
}
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:20: error: expected ';' before '<' token
10 | for (int i = 0, i < n; i++) {
| ^~
| ;
a.cc:10:21: error: expected primary-expression before '<' token
10 | for (int i = 0, i < n; i++) {
| ^
|
s452389002 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long n, c, k; cin >> n >> c >> k;
long a[n];
for (int i = 0; i < n; i++) cin >> a[i];
sort(a.begin(), a.end());
int ran = 0, cnt = 0;
for (int i = 0, i < n; i++) {
if (a[i] - a[ran] > K||i-ran+1>c) {
ran = i;
cnt++;
}
}
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:10: error: request for member 'begin' in 'a', which is of non-class type 'long int [n]'
8 | sort(a.begin(), a.end());
| ^~~~~
a.cc:8:21: error: request for member 'end' in 'a', which is of non-class type 'long int [n]'
8 | sort(a.begin(), a.end());
| ^~~
a.cc:10:20: error: expected ';' before '<' token
10 | for (int i = 0, i < n; i++) {
| ^~
| ;
a.cc:10:21: error: expected primary-expression before '<' token
10 | for (int i = 0, i < n; i++) {
| ^
a.cc:11:25: error: 'K' was not declared in this scope
11 | if (a[i] - a[ran] > K||i-ran+1>c) {
| ^
|
s044405207 | p03785 | C++ | #include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;
int main()
{
lint N,C,K;
lint T[100010]={};
cin >> N >> C >> K;
for(lint i=0;i<N;i++)
cin >> T[i];
sort(T,T+N);
lint base=T[0];
lint cnt=0;
lint ans=0;
for(lint i=0;i<N;i++)
{
if(T[i]>=base+K || cnt>=C)
{
ans++
base=T[i];
cnt=0;
}
cnt++;
}
ans++;
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:30: error: expected ';' before 'base'
24 | ans++
| ^
| ;
25 | base=T[i];
| ~~~~
|
s652919413 | p03785 | C++ | #include <iostream>
using namespace std;
int main() {
int n,c,k;
cin >> n >> c >> k;
int t[n];
for(int i=0;i<n;i++) cin >> t[i];
sort(t, t+n);
int res = 0;
for(int i=0;i<n;i++){
int j = 0;
while(j < c && (t[j+i+1] - t[i]) <= k ){
j++;
i++;
}
res++;
}
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
10 | sort(t, t+n);
| ^~~~
| short
|
s179673452 | p03785 | C++ | #include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1);
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
#define ll long long
#define inf int(1e9+7)
#define pb push_back
#define mp make_pair
pair<int,int>p[100005];
bool gone[100005];
int n,c,k;
int main()
{
cin>>n>>c>>k;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
p[i]=mp(x,x+k);
}
sort(p,p+n);
int ans=0;
for(int i=0;i<n;i++)
{
if(gone[i]==0)
{
int sum=0;
int up=p[i].second;
for(int j=0;j<n;j++)
if(p[j].first<=up&&!gone[j])
{
gone[j]=1;
sum++;
}
sum=sum/k+1
ans+=sum;
}
}
cout<<ans+1;
return 0;
} | a.cc: In function 'int main()':
a.cc:36:36: error: expected ';' before 'ans'
36 | sum=sum/k+1
| ^
| ;
37 | ans+=sum;
| ~~~
|
s212399889 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int cnt=1, N, C, K, s=0;
bool flg = true;
cin >> N >> C >> K;
vector<int> T(N,0);
for (int i = 0; i<N; i++) cin >> T[i];
sort(T.begin(),T.end());
for (int i = 1; i<N; i++) {
if(T[i]>T[s]+K || i==s+C) {
cnt++;
s=i;
}
}
printf("%d\n" cnt);
} | a.cc: In function 'int main()':
a.cc:17:16: error: expected ')' before 'cnt'
17 | printf("%d\n" cnt);
| ~ ^~~~
| )
|
s823140381 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int cnt=1, N, C, K, s=0;
bool flg = true;
cin >> N >> C >> K;
vector<int> T(N,0);
for (int i = 0; i<N; i++) cin >> T[i];
sort(T.begin(),T.end());
for (int i = 1; i<N; i++) {
if(T[i]>T[s]+K || i==s+C) {
cnt++;
s=i;
}
}
printf("d%\n" cnt);
} | a.cc: In function 'int main()':
a.cc:17:16: error: expected ')' before 'cnt'
17 | printf("d%\n" cnt);
| ~ ^~~~
| )
|
s768865791 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int cnt=0, N, C, K, s=0;
bool flg = true;
cin >> N >> C >> K;
vector<int> T(N,0);
for (int i = 0; i<N; i++) cin >> T[i];
sort(T.begin(),T.end());
for (int i = 1; i<N; i++) {
if(T[i]>T[s]+K || i=s+C) {
cnt++;
s=i;
}
}
cout << cnt << "\n";
} | a.cc: In function 'int main()':
a.cc:12:20: error: lvalue required as left operand of assignment
12 | if(T[i]>T[s]+K || i=s+C) {
|
s639709830 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int cnt=0, s=0;
long long N, C, K;
vector<int> T(N,0);
cin >> N >> C >> K;
for (int i = 0; i<N; i++) cin >> T[i];
sort(T.begin(),T.end());
while(s < N) {
cnt++;
for (long long i = min(s,N)+1; i<min(C+s,N); i++) {
if(T[i] > T[min(s,N)]+K) {
s = i;
break;
}
s = i + 1;
}
}
cout << cnt << "\n";
}
| a.cc: In function 'int main()':
a.cc:13:27: error: no matching function for call to 'min(int&, long long int&)'
13 | for (long long i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:13:27: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
13 | for (long long i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:13:27: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
13 | for (long long i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~
a.cc:14:22: error: no matching function for call to 'min(int&, long long int&)'
14 | if(T[i] > T[min(s,N)]+K) {
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:14:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
14 | if(T[i] > T[min(s,N)]+K) {
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:14:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
14 | if(T[i] > T[min(s,N)]+K) {
| ~~~^~~~~
|
s458914970 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, t, cnt=0, s=0;
long long C, K;
vector<int> T(N,0);
cin >> N >> C >> K;
for (int i = 0; i<N; i++) cin >> T[i];
sort(T.begin(),T.end());
while(s < N) {
cnt++;
for (long long i = min(s,N)+1; i<min(C+s,N); i++) {
if(T[i] > T[min(s,N)]+K) {
s = i;
break;
}
s = i + 1;
}
}
cout << cnt << "\n";
}
| a.cc: In function 'int main()':
a.cc:13:41: error: no matching function for call to 'min(long long int, int&)'
13 | for (long long i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:13:41: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
13 | for (long long i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:13:41: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
13 | for (long long i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~~~
|
s394423241 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, t, cnt=0, s=0;
long long C, K;
vector<int> T(N,0);
cin >> N >> C >> K;
for (int i = 0; i<N; i++) cin >> T[i];
sort(T.begin(),T.end());
while(s < N) {
cnt++;
for (int i = min(s,N)+1; i<min(C+s,N); i++) {
if(T[i] > T[min(s,N)]+K) {
s = i;
break;
}
s = i + 1;
}
}
cout << cnt << "\n";
}
| a.cc: In function 'int main()':
a.cc:13:35: error: no matching function for call to 'min(long long int, int&)'
13 | for (int i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:13:35: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
13 | for (int i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:13:35: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
13 | for (int i = min(s,N)+1; i<min(C+s,N); i++) {
| ~~~^~~~~~~
|
s234551238 | p03785 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
long long int N,C;
cin >> N >> C;
float K;
cin >> K;
vector<float> A(N,0.0);
for(long long int i = 0LL ; i < N; i++){
cin >> A[i];
}
sort(A.begin(), A.end(), greater<long long int>());
long long int p = 1LL;
long long int b = 1LL;
float fP = A[0];
for(long long int i = 0LL ; i < N; i++){
if(p >= C || A[i+1] < fP - K){
b++;
fP = A[i+1];
p = 1LL;
continue;
}
p++;
}
cout << b;
}
| a.cc:22:1: error: extended character is not valid in an identifier
22 | if(p >= C || A[i+1] < fP - K){
| ^
a.cc: In function 'int main()':
a.cc:22:1: error: '\U00003000' was not declared in this scope
22 | if(p >= C || A[i+1] < fP - K){
| ^~
|
s707176771 | p03785 | C++ |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
int main (){
ll n,c,k;
cin >> n >> c >> k;
vector<ll> tvec(n);
for(int i = 0; i < n; i++){
cin >> tvec.at(i);
}
sort(tvec.begin(),tvec.end());
ll count = 0;
cout << tvec.at(2) <<endl;
for(ll i = 0; i < n;) {
cout << i << endl;
if(i + c -2> n-1){
count++;
break;
}
if(tvec.at(i+c-1) - tvec.at(i) <= k){
i += c;
count++;
}else{
ll maxu = 0;
for(int j = i; tvec.at(j) <= tvec.at(i) + k; j++){
if(maxu < j){
maxu = j;
}
}
i += maxu;
count++;
}
}
cout << count << endl;
return 0;
}
/*実装が上記のようにエラーがなってよくわからん
out of rangeが出るがどこでそうなるのかわからん
結局よく分かんなんかった 考え方はあってるけれど
多分実装に関して考えきれてない、範囲の考えとか
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int> P;
typedef vector<P> vip;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
int main (){
int n;
ll c,k;
cin >> n >> c >> k;
vl t(n+1);
REPS(i,n){
cin >> t.at(i);
}
sort(t.begin(),t.end());//0は0にくる
bool first = true;
ll start;
ll ans = 0;
ll count = 0;//count 人数 ans はバス数
REPS(i,n){
if(first){//最初乗るところでcount start first初期化 バスans増やす 人のせる。
start = t.at(i);
first = false;
ans++;
count = 1;
}
if(count == c){//出発
first = true;
continue;
}
else if(i+1 <= n && start + k < t.at(i+1)){
first = true;
continue;
}else if(!first) count++;
}
cout << ans << endl;
return 0;
} | a.cc:65:10: error: redefinition of 'const long long int mod'
65 | const ll mod = 1e9 + 7;
| ^~~
a.cc:11:10: note: 'const long long int mod' previously defined here
11 | const ll mod = 1e9 + 7;
| ^~~
a.cc:76:5: error: redefinition of 'int main()'
76 | int main (){
| ^~~~
a.cc:13:5: note: 'int main()' previously defined here
13 | int main (){
| ^~~~
|
s229481534 | p03785 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef ll long long
int main() {
int n;
ll c,k;
cin >> n >> k;
ll t[n];
int ans = 1;
ll start;
for (int i = 0;i < n;i++) {
cin >> t[i];
}
sort(t,t+n);
start = t[0];
for (int i = 1;i < n;i++) {
if (t[i]-start > k) {
ans++;
start = t[i];
}
}
if (start == t[n-1]) ans++;
cout << ans << endl;
} | a.cc:3:9: error: 'll' does not name a type
3 | typedef ll long long
| ^~
|
s214897719 | p03785 | C++ | import qualified Data.ByteString.Char8 as C
import Data.Maybe (isJust, fromJust)
import Control.Monad (replicateM)
import Data.List (sort, drop, length, filter, take)
import qualified Data.Vector.Unboxed as U
import Control.Arrow (first) -- first :: Arrow a => a b c -> a (b, d) (c, d)
cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine
getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine
main :: IO ()
main = do
[n,c,k] <- getParms -- passengers, maximum num in a bus, and limit time
-- ts <- (U.fromList . sort) <$> replicateM n cReadLn -- i-th passenger's arrival time
ts <- sort <$> replicateM n cReadLn -- i-th passenger's arrival time
print $ length $ solve' c k ts
f :: Int -> Int -> U.Vector Int -> Int
f c k ts = solver c k ts 0
where
solver :: Int -> Int -> U.Vector Int -> Int -> Int
solver _ _ ts n
| U.null ts = n
solver c k ts n = solver c k qs (n+1)
where p = inABus c k ts
qs = U.drop p ts
overWrap :: Int -> Int -> Int -> Int
overWrap k t0 t1 = (t0+k - t1)
inABus
:: Int -> Int -> U.Vector Int -> Int
inABus c k tt = U.length . U.filter (0<=) . U.map (overWrap k t) . U.take c $ tt
where
t = U.head tt
-- https://atcoder.jp/contests/agc011/submissions/3109211
solve :: [Int] -> Int -> Int -> [[Int]]
solve [] _ _ = []
solve xs c k = a : solve b c k
where
(a,b) = aux (head xs) xs 1
aux :: Int -> [Int] -> Int -> ([Int],[Int])
aux _ [] _ = ([],[])
aux t0 xx@(x:xs) c0
| c0 <= c && x <= t0+k = first (x:) (aux t0 xs (c0+1))
| otherwise = ([], xx)
-- first (1:) :: ([Int], [Int]) -> ([Int], [Int])
solve' :: Int -> Int -> [Int] -> [[Int]]
solve' _ _ [] = []
solve' c k xs@(x:_) = a : solve' c k ys
where
(a,ys) = aux x xs 1
aux :: Int ->[Int] -> Int -> ([Int], [Int])
aux _ [] _ = ([],[])
aux t xx@(x:xs) c0
| c0<=c && x<= t+k = (\(cs,ds) -> ((x:cs), ds)) (aux t xs (c0+1))
| otherwise = ([],xx) | a.cc:17:73: warning: missing terminating ' character
17 | -- ts <- (U.fromList . sort) <$> replicateM n cReadLn -- i-th passenger's arrival time
| ^
a.cc:17:73: error: missing terminating ' character
17 | -- ts <- (U.fromList . sort) <$> replicateM n cReadLn -- i-th passenger's arrival time
| ^~~~~~~~~~~~~~~
a.cc:18:56: warning: missing terminating ' character
18 | ts <- sort <$> replicateM n cReadLn -- i-th passenger's arrival time
| ^
a.cc:18:56: error: missing terminating ' character
18 | ts <- sort <$> replicateM n cReadLn -- i-th passenger's arrival time
| ^~~~~~~~~~~~~~~
a.cc:19:25: warning: missing terminating ' character
19 | print $ length $ solve' c k ts
| ^
a.cc:19:25: error: missing terminating ' character
19 | print $ length $ solve' c k ts
| ^~~~~~~~
a.cc:49:14: error: stray '@' in program
49 | aux t0 xx@(x:xs) c0
| ^
a.cc:55:6: warning: missing terminating ' character
55 | solve' :: Int -> Int -> [Int] -> [[Int]]
| ^
a.cc:55:6: error: missing terminating ' character
55 | solve' :: Int -> Int -> [Int] -> [[Int]]
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:56:6: warning: missing terminating ' character
56 | solve' _ _ [] = []
| ^
a.cc:56:6: error: missing terminating ' character
56 | solve' _ _ [] = []
| ^~~~~~~~~~~~~
a.cc:57:6: warning: multi-character literal with 25 characters exceeds 'int' size of 4 bytes
57 | solve' c k xs@(x:_) = a : solve' c k ys
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:62:13: error: stray '@' in program
62 | aux t xx@(x:xs) c0
| ^
a.cc:63:29: error: stray '\' in program
63 | | c0<=c && x<= t+k = (\(cs,ds) -> ((x:cs), ds)) (aux t xs (c0+1))
| ^
a.cc:1:1: error: 'import' does not name a type
1 | import qualified Data.ByteString.Char8 as C
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s467778922 | p03785 | C++ | #include <iostream>
int main(void)
{
int n, c, k, t[100000] = {};
int ans = 0, first = 0;
std::cin >> n >> c >> k;
for(int i = 0; i != n; i++) std::cin >> t[i];
std::sort(t, t + n);
for(int i = 0; i != n; i++){
if(t[i] - t[first] > k || i - first >= c){
first = i;
ans++;
}
}
std::cout << ans + 1 << std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
8 | std::sort(t, t + n);
| ^~~~
| qsort
|
s024332553 | p03785 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, c, k;
cin >> n >> c >> k;
vector<int> t(n);
for (int i = 0; i < n; i++)
cin >> t[i];
sort(t.begin(), t.end());
int ans = 0;
for (int i = 0; i < n;) {
int j = i + 1;
int person = 1;
ans++;
while (person < c && t[i] + k >= t[j]) {
person++;
j++;
}
i = j;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(t.begin(), t.end());
| ^~~~
| short
|
s584753991 | p03785 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <stdlib.h>
#include <list>
#include <map>
#include <utility>
#include <set>
#include <bitset>
#include <vector>
#define pi acos(-1.0)
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fLL
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
int min3(int a,int b,int c){return min(min(a,b),c);}
int max3(int a,int b,int c){return max(max(a,b),c);}
int gcd(int x, int y){if(y==0)return x;return gcd(y, x%y);}
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();return x*f;}
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const int maxn=1e6+6;
typedef long long ll;
const int mod=1e9+7;
int a[maxn];
int main()
{
int n,c,k;
scanf("%d%d%d",&n,&c,&k);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
int last=a[1];
int cnt=1;
int ans=0;
for(int i=1;i<=n;i++)
{
if(a[i]<=last+k)
{
cnt++;
if(cnt>c)cnt=1,ans++,last=a[i];
}
else
{
cnt=1;
last=a[i];
ans++;
}
}
printf("%d\n",ans+1);
return 0;
}
#include<bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <stdlib.h>
#include <list>
#include <map>
#include <utility>
#include <set>
#include <bitset>
#include <vector>
#define pi acos(-1.0)
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fLL
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
int min3(int a,int b,int c){return min(min(a,b),c);}
int max3(int a,int b,int c){return max(max(a,b),c);}
int gcd(int x, int y){if(y==0)return x;return gcd(y, x%y);}
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();return x*f;}
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const int maxn=1e6+6;
typedef long long ll;
const int mod=1e9+7;
int a[maxn];
int main()
{
int n,c,k;
scanf("%d%d%d",&n,&c,&k);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
sort(a+1,a+n+1);
int last=a[1];
int cnt=1;
int ans=0;
for(int i=1;i<=n;i++)
{
if(a[i]<=last+k)
{
cnt++;
if(cnt>c)cnt=1,ans++,last=a[i];
}
else
{
cnt=1;
last=a[i];
ans++;
}
}
printf("%d\n",ans+1);
return 0;
}
| a.cc:84:5: error: redefinition of 'int min3(int, int, int)'
84 | int min3(int a,int b,int c){return min(min(a,b),c);}
| ^~~~
a.cc:25:5: note: 'int min3(int, int, int)' previously defined here
25 | int min3(int a,int b,int c){return min(min(a,b),c);}
| ^~~~
a.cc:85:5: error: redefinition of 'int max3(int, int, int)'
85 | int max3(int a,int b,int c){return max(max(a,b),c);}
| ^~~~
a.cc:26:5: note: 'int max3(int, int, int)' previously defined here
26 | int max3(int a,int b,int c){return max(max(a,b),c);}
| ^~~~
a.cc:86:5: error: redefinition of 'int gcd(int, int)'
86 | int gcd(int x, int y){if(y==0)return x;return gcd(y, x%y);}
| ^~~
a.cc:27:5: note: 'int gcd(int, int)' previously defined here
27 | int gcd(int x, int y){if(y==0)return x;return gcd(y, x%y);}
| ^~~
a.cc:87:12: error: redefinition of 'int read()'
87 | inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();return x*f;}
| ^~~~
a.cc:28:12: note: 'int read()' previously defined here
28 | inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();return x*f;}
| ^~~~
a.cc:89:11: error: redefinition of 'const int maxn'
89 | const int maxn=1e6+6;
| ^~~~
a.cc:30:11: note: 'const int maxn' previously defined here
30 | const int maxn=1e6+6;
| ^~~~
a.cc:91:11: error: redefinition of 'const int mod'
91 | const int mod=1e9+7;
| ^~~
a.cc:32:11: note: 'const int mod' previously defined here
32 | const int mod=1e9+7;
| ^~~
a.cc:92:5: error: redefinition of 'int a [1000006]'
92 | int a[maxn];
| ^
a.cc:33:5: note: 'int a [1000006]' previously declared here
33 | int a[maxn];
| ^
a.cc:93:5: error: redefinition of 'int main()'
93 | int main()
| ^~~~
a.cc:34:5: note: 'int main()' previously defined here
34 | int main()
| ^~~~
|
s663210691 | p03785 | C++ | #include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;
const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount
int main() {
int N, C, K;
cin >> N >> C >> K;
vector<int> T(N);
for (int i = 0; i < N; i++) cin >> T[i];
sort(all(T));
T.push_back(2000000001);
int capa = 0, t = 0, bus = 0;
for (int i = 0; i < N + 1; i++)
{
int fp = T[i];
capa = 1;
t = fp;
while (t <= fp + K) {
if (capa + 1>C)break;
i++;
capa++;
t = T[i];
}
bus++;
}
cout << bus << endl;
return 0;
} | a.cc:9:19: error: 'acos' was not declared in this scope
9 | const double PI = acos(-1.0);
| ^~~~
|
s614448663 | p03785 | C++ | #include <iostream>
#include <cstdlib>
using namespace std;
int main(void) {
int n, c, k;
cin >> n >> c >> k;
int t[100000];
for (int i = 0; i < n; i++) {
cin >> t[i];
}
sort(t, t + n);
int departure = -1;
int got = 0;
int res = 1;
for (int i = 0; i < n; i++) {
if (departure < 0) {
departure = t[i] + k;
got = 1;
} else if (departure < t[i]) {
departure = t[i] + k;
got = 1;
res++;
} else if (got == c) {
departure = t[i] + k;
got = 1;
res++;
} else {
got++;
}
}
cout << res << endl;
return EXIT_SUCCESS;
}
| a.cc: In function 'int main()':
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'?
14 | sort(t, t + n);
| ^~~~
| short
|
s157487606 | p03785 | C++ | 6 3 3
7
6
2
8
10
6 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 6 3 3
| ^
|
s650991652 | p03785 | C++ | #include<bits/stdc++,h>
using namespace std;
#define ll long long
int main(){
ll n,c,k;
cin>>n>>c>>k;
vector<ll> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a.begin(),a.end());
ll cnt=1,knt=a[0],count=1;
for(int i=1;i<n;i++){
if(a[i]-knt<=k&&cnt<c){
cnt++;
}else{
count++;
knt=a[i];
cnt=1;
}
}
cout<<count;
} | a.cc:1:9: fatal error: bits/stdc++,h: No such file or directory
1 | #include<bits/stdc++,h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s150290569 | p03785 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
int n, c, k;
cin >> n >> c >> k;
vector<int> t(n);
for (int i = 0; i < n; i++) {
cin >> t.at(i);
sort(t.begin(), t.end());
int ans = 1;
int count = 1;
int ht = t.at(0);
for (int i = 0; i < n; i++) {
if (count == c + 1) {
ans++;
ht = t.at(i);
count = 1;
}
else if (t.at(i) > ht + k) {
ans++;
ht = t.at(i);
count = 1;
}
count++;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:39:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
39 | cout << ans << endl;
| ^~~
| abs
|
s151019261 | p03785 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
int n, c, k;
cin >> n >> c >> k;
vector<int> t(n);
for (int i = 0; i < n; i++) {
cin >> t.at(i);
sort(t.begin(), t.end());
int ans = 1;
int count = 1;
int ht = t.at(0);
for (int i = 0; i < n; i++) {
if (count == c + 1) {
ans++;
ht = t.at(i);
count = 1;
}
else if (t.at(i) > ht + k) {
ans++;
ht = t.at(i);
count = 1;
}
count++;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s111583732 | p03785 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
int n, c, k;
cin >> n >> c >> k;
vector<int> t(n);
for (nit i = 0; i < n; i++) {
cin >> t.at(i);
sort(t.begin(), t.end());
int ans = 1;
int count = 1;
int ht = t.at(0);
for (int i = 0; i < n; i++) {
if (count == c + 1) {
ans++;
ht = t.at(i);
count=1
}
else if (t.at(i) > ht + k) {
ans++;
ht = t.at(i);
count=1
}
count++;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:12:14: error: 'nit' was not declared in this scope; did you mean 'int'?
12 | for (nit i = 0; i < n; i++) {
| ^~~
| int
a.cc:12:25: error: 'i' was not declared in this scope
12 | for (nit i = 0; i < n; i++) {
| ^
a.cc:26:40: error: expected ';' before '}' token
26 | count=1
| ^
| ;
27 | }
| ~
a.cc:31:40: error: expected ';' before '}' token
31 | count=1
| ^
| ;
32 | }
| ~
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s147686712 | p03785 | C++ | #include<bits/stdd++.h>
using namespace std;
int main() {
int n, c, k;
cin >> n >> c >> k;
vector<int> t(n);
for (nit i = 0; i < n; i++) {
cin >> t.at(i);
sort(t.begin(), t.end());
int ans = 1;
int count = 1;
int ht = t.at(0);
for (int i = 0; i < n; i++) {
if (count == c + 1) {
ans++;
ht = t.at(i);
count=1
}
else if (t.at(i) > ht + k) {
ans++;
ht = t.at(i);
count=1
}
count++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits/stdd++.h: No such file or directory
1 | #include<bits/stdd++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.