submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s180277001 | p00274 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
int a, n, i, m k = 0;
cin >> n;
m = n;
while(n != 0 || k != 100) {
for(i = 1; i <= n; i++) {
cin >> a;
if (a <= 1) {
m--;
}
}
if (m <= 0) {
cout << "NA" << endl;
}else{
cout << m + 1 << endl;
}
cin >> n;
m = n;
k++;
}
}
| a.cc: In function 'int main()':
a.cc:5:24: error: expected initializer before 'k'
5 | int a, n, i, m k = 0;
| ^
a.cc:7:9: error: 'm' was not declared in this scope
7 | m = n;
| ^
a.cc:8:25: error: 'k' was not declared in this scope
8 | while(n != 0 || k != 100) {
| ^
|
s831987682 | p00274 | C++ |
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;
int32_t N;
int main()
{
using std::endl;
in.sync_with_stdio(false);
out.sync_with_stdio(false);
in.tie(nullptr);
out.tie(nullptr);
for (;;)
{
in >> N;
if (N == 0) { break; }
bool over1 = false;
int32_t count = 0;
for (size_t i = 0; i < N; i++)
{
if (A[i] > 0) {
++count;
over1 |= (A[i] >= 2);
}
}
if (over1) {
out << count + 1 << endl;
}
else {
out << "NA" << endl;
}
}
return 0;
}
#endif
| a.cc: In function 'int main()':
a.cc:49:29: error: 'A' was not declared in this scope
49 | if (A[i] > 0) {
| ^
|
s442238192 | p00274 | C++ | #include<stdio.h>
int main(void){
int N = 1;
static int k[10000];
int i;
int a, b;
for (;;){
scanf_s("%d", &N);
if (N == 0)
break;
for (i = 0; i < N; i++)
scanf_s("%d", &k[i]);
a = 0, b = 0;
for (i = 0; i < N; i++){
if (k[i] == 0)
a++;
if (k[i] < 2)
b++;
}
if (b == N)
printf("NA\n");
else{
N = N - a + 1;
printf("%d\n", N);
}
}
}
| a.cc: In function 'int main()':
a.cc:9:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
9 | scanf_s("%d", &N);
| ^~~~~~~
| scanf
|
s335675996 | p00274 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 1e4;
int main(){
int n;
while(cin >> n,n){
int k[MAX+1],m = 1<<29,M = -1<<29;
bool flg = false;
for(int i = 0 ; i < n ; i++){#include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 1e4;
int main(){
int n;
while(cin >> n,n){
int k[MAX+1],m = 1<<29,M = -1<<29;
bool flg = false;
for(int i = 0 ; i < n ; i++){
cin >> k[i];
if(k[i] >= 2) flg = true;
m = min(m,k[i]);
M = max(M,k[i]);
}
if(!flg) cout << "NA" << endl;
else{
if(n == 1) cout << "2" << endl;
else{
int d = M - m;
cout << m+d << endl;
}
}
}
return 0;
} | a.cc:12:34: error: stray '#' in program
12 | for(int i = 0 ; i < n ; i++){#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:12:35: error: 'include' was not declared in this scope
12 | for(int i = 0 ; i < n ; i++){#include <iostream>
| ^~~~~~~
a.cc:12:52: error: expected primary-expression before '>' token
12 | for(int i = 0 ; i < n ; i++){#include <iostream>
| ^
a.cc:14:1: error: expected primary-expression before 'using'
14 | using namespace std;
| ^~~~~
a.cc:17:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
17 | int main(){
| ^~
a.cc:17:9: note: remove parentheses to default-initialize a variable
17 | int main(){
| ^~
| --
a.cc:17:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:17:11: error: a function-definition is not allowed here before '{' token
17 | int main(){
| ^
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:12:33: note: to match this '{'
12 | for(int i = 0 ; i < n ; i++){#include <iostream>
| ^
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:9:20: note: to match this '{'
9 | while(cin >> n,n){
| ^
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:6:11: note: to match this '{'
6 | int main(){
| ^
|
s405936677 | p00274 | C++ | #include <iostream>
using namespace std;
int N,a,b,c;
int main(){
for(;;){
cin >> N
if(N==0){
a = 1;
b = 0;
for(int i = 0; i < N; i++){
cin >> c;
if(c != 0){
a++;
}
if(c > 1){
b++;
}
}
if(b == 0){
cout << "NA" << endl;
}else{
cout << a << endl;
}
}else{
break;
}
}
} | a.cc: In function 'int main()':
a.cc:8:13: error: expected ';' before 'if'
8 | cin >> N
| ^
| ;
9 | if(N==0){
| ~~
a.cc:26:6: error: 'else' without a previous 'if'
26 | }else{
| ^~~~
|
s736189139 | p00274 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),n.end()
#define PI acos(-1)
using namespace std;
int main(){
int n;
while(cin>>n,n){
int e=0;
vector<int>in;
rep(i,n){
int tmp;
cin>>tmp;
if(e<tmp)e=tmp;
pb(in,tmp);
}
if(tmp<2)cout<<in.size()+1<<endl;
else cout<<"NA"<<endl;
}
} | a.cc: In function 'int main()':
a.cc:25:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
25 | if(tmp<2)cout<<in.size()+1<<endl;
| ^~~
| tm
|
s613464587 | p00275 | Java | import java.util.*;
public class Bonze {
public static void main(String[] args){
int n, field = 0, taihi = 0, zyun = 0;
String a;
Scanner scan = new Scanner(System.in);
while(true){
n = scan.nextInt();
if(n == 0)break;
int[] player = new int[n];
for(int b = 0; b < n; b++){
player[b] = 0;
}
a = scan.next();
char[] hairetu = a.toCharArray();
for(int i = 0; i < 100; i++){
zyun = i % n;
if(hairetu[i] == 'S'){
field = field + player[zyun] + 1;
player[zyun] = 0;
}
if(hairetu[i] == 'L'){
player[zyun] = player[zyun] + field + 1;
field = 0;
}
if(hairetu[i] == 'M'){
player[zyun] = player[zyun] + 1;
}
}
for(int j = 0; j < n - 1; j++){
for(int k = n - 1; k > j; k-- ){
if(player[j] > player[k]){
taihi = player[j];
player[j] = player[k];
player[k] = taihi;
}
}
}
for(int l = 0; l < n; l++){
System.out.print(player[l] + " ");
}
System.out.println(field);
}
}
} | Main.java:3: error: class Bonze is public, should be declared in a file named Bonze.java
public class Bonze {
^
1 error
|
s329920326 | p00275 | Java | import java.util.*;
public class Bonze {
public static void main(String[] args){
int n, field = 0, taihi = 0, zyun = 0;
String a;
Scanner scan = new Scanner(System.in);
while(true){
n = scan.nextInt();
if(n == 0)break;
int[] player = new int[n];
for(int b = 0; b < n; b++){
player[b] = 0;
}
a = scan.next();
char[] hairetu = a.toCharArray();
for(int i = 0; i < 100; i++){
zyun = i % n;
if(hairetu[i] == 'S'){
field = field + player[zyun] + 1;
player[zyun] = 0;
}
if(hairetu[i] == 'L'){
player[zyun] = player[zyun] + field + 1;
field = 0;
}
if(hairetu[i] == 'M'){
player[zyun] = player[zyun] + 1;
}
}
for(int j = 0; j < n - 1; j++){
for(int k = n - 1; k > j; k-- ){
if(player[j] > player[k]){
taihi = player[j];
player[j] = player[k];
player[k] = taihi;
}
}
}
for(int l = 0; l < n; l++){
System.out.print(player[l] + " ");
}
System.out.println(field);
}
}
} | Main.java:3: error: class Bonze is public, should be declared in a file named Bonze.java
public class Bonze {
^
1 error
|
s032070954 | p00275 | Java |
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n,ba = 0,jun = 0;
String a;
while(true){
n = scan.nextInt();
if(n == 0) break;
int[] mochi = new int[n];
a = scan.next();
char fuda[] = a.toCharArray();
for(int i = 0; i<100; i++){
switch(fuda[i]){
case 'M':
if(jun == n) jun = 0;
mochi[jun] += 1;
jun++;
break;
case 'S':
if(jun == n) jun = 0;
ba += mochi[jun] + 1; //banidasu
mochi[jun] =0; //mochifudazero
jun++;
break;
case 'L':
if(jun == n) jun = 0;
mochi[jun] += ba +1;
ba = 0;
jun++;
break;
}
}
Arrays.sort(mochi);
for(int i = 0;i<mochi.length;i++){
System.out.print(mochi[i]);
System.out.print(" ");
}
System.out.println(ba);
jun = 0; ba = 0;
}
}
} | Main.java:4: error: cannot find symbol
Scanner scan = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner scan = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:34: error: cannot find symbol
Arrays.sort(mochi);
^
symbol: variable Arrays
location: class Main
3 errors
|
s321354031 | p00275 | Java | import java.util.*;
public class Main{
public void output(){
Scanner scan = new Scanner(System.in);
int[] hito = new int[1000];
int p = 0;
int g = 0;
int taihi = 0;
while(true){
int n = scan.nextInt();
if(n == 0)break;
int yama = 0;
int ba = 0;
for(int r = 0;r < n;r++){
hito[r] = 0;
}
String huda1 = scan.next();
char[] huda = huda1.toCharArray();
for(int i = 0; i < 100; i++){
/*if(p == n-1){
p = 0;
}*/
p = i % n;
if(huda[yama] == 'M'){
hito[p] = hito[p] + 1;
}
if(huda[yama] == 'S'){
hito[p] = hito[p] + 1;
ba = ba + hito[p];
hito[p] = 0;
}
if(huda[yama] == 'L'){
hito[p] = hito[p] + 1;
hito[p] = hito[p] + ba;
ba = 0;
}
yama = yama + 1;
}
for(int u = 0; u < n-1; u++){
for(int t = n-1; t > u;t--){
if(hito[t]<hito[t-1]){
taihi = hito[t];
hito[t] = hito[t-1];
hito[t-1]=taihi;
}
}
}
for(g = 0; g < n;g++){
System.out.print(hito[g] + " ");
}
System.out.println(ba);
}
}
}
} | Main.java:56: error: class, interface, enum, or record expected
}
^
1 error
|
s402345448 | p00275 | C | #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
int N;
int p[10]={0};
int i,j,temp,s;
int ba=0;
char c[200];
while(1){
cin>>N;
if(N==0){
break;
}
ba=0;
for(i=0;i<10;i++){
p[i]=0;
}
cin>>c;
for(j=0;j<100;j++){
s=j%N;
if(c[j]=='M'){
p[s]=p[s]+1;
}
else if(c[j]=='S'){
ba=ba+p[s];
p[s]=0;
ba=ba+1;
}
else if(c[j]=='L'){
p[s]=p[s]+ba;
ba=0;
p[s]=p[s]+1;
}
}
for(i=0;i<N;i++){
for(j=N-1;j>i;j--){
if(p[i]>p[j]){
temp=p[i];
p[i]=p[j];
p[j]=temp;
}
}
}
for(i=0;i<N;i++){
printf("%4d",p[i]);
}
printf("%4d",ba);
}
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s473472609 | p00275 | C | #include<stdio.h>
int main(void)
{
int n,i,r,f,h,u,x=0;
char c[100+1];
char p[10];
scanf("%d",&n);
scanf("%s",&c);
r=0;
p=0;
for(i=0;i<100;i++){
switch( c[i] ){
case 'M':
p[r]=p[r]+1;
break;
case 'S':
p[10]=h+1-c;
p[r]=x+p[r];
break;
case 'L':
p[r]=p[r]+x;;
f=0;
break;
}
r = (r+1)%n;
}
for(i=0;i<100;i++)[
p[r]=c;
p[r]=0;
}
for(i=0;i<n;i++){
printf("%d ",p[i]);
}
printf("\n");
return 0;
} | main.c: In function 'main':
main.c:10:10: error: assignment to expression with array type
10 | p=0;
| ^
main.c:17:34: error: invalid operands to binary - (have 'int' and 'char *')
17 | p[10]=h+1-c;
| ~~~^
| | |
| | char *
| int
main.c:27:27: error: expected expression before '[' token
27 | for(i=0;i<100;i++)[
| ^
main.c:28:21: error: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
28 | p[r]=c;
| ^
main.c:29:24: error: expected ';' before '}' token
29 | p[r]=0;
| ^
| ;
30 | }
| ~
main.c: At top level:
main.c:31:9: error: expected identifier or '(' before 'for'
31 | for(i=0;i<n;i++){
| ^~~
main.c:31:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
31 | for(i=0;i<n;i++){
| ^
main.c:31:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
31 | for(i=0;i<n;i++){
| ^~
main.c:34:16: error: expected declaration specifiers or '...' before string constant
34 | printf("\n");
| ^~~~
main.c:35:9: error: expected identifier or '(' before 'return'
35 | return 0;
| ^~~~~~
main.c:36:1: error: expected identifier or '(' before '}' token
36 | }
| ^
|
s144312265 | p00275 | C | #include<stdio.h>
int main(void)
{
while(1){
int n,i,j=0,t[10]={0},fi=0,bum
char c[201];
scanf("%d",&n);
if(n==0){
break;
}
scanf("%s",c);
for(i=0;i<100;i++){
t[j]++;
if(c[i]=='S'){
fi=fi+t[j];
t[j]=0;
}
if(c[i]=='L'){
t[j]=t[j]+fi;
fi=0;
}
j++;
if(j==n){
j=0;
}
}
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
if(t[i]>t[j]){
bum=t[i];
t[i]=t[j];
t[j]=bum;
}
}
}
for(i=0;i<n;i++){
printf("%d ",t[i]);
}
printf("%d\n",fi);
}
return 0;
} | main.c: In function 'main':
main.c:6:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char'
6 | char c[201];
| ^~~~
main.c:11:28: error: 'c' undeclared (first use in this function)
11 | scanf("%s",c);
| ^
main.c:11:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:30:41: error: 'bum' undeclared (first use in this function)
30 | bum=t[i];
| ^~~
|
s680543217 | p00275 | C | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
for(getchar(),i=0;(j=getchar())!='\n';i++)if(j=='M')a[i%N]++;else if(j-'L')a[N]+=a[i%N]+1,a[i%N]=0;else a[i%N]+=a[N]+1,a[N]=0;
for(i=0;i<N;printf("%d ",a[i++])for(j=N-1;j>i;j--)if(a[j]<a[j-1])a[j-1]^=a[j],a[j]^=a[j-1],a[j-1]^=a[j];
printf("%d\n",a[N]);
}} | main.c:1:1: warning: data definition has no type or storage class
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:7: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
| ^
main.c:1:9: error: return type defaults to 'int' [-Wimplicit-int]
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
| ^~~~
main.c: In function 'main':
main.c:1:9: error: type of 'N' defaults to 'int' [-Wimplicit-int]
main.c:1:9: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:24: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
main.c:1:24: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
| ^~~~~
main.c:1:24: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:43: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
+++ |+#include <string.h>
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
main.c:1:43: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
1 | a[11],j;main(N,i){for(;scanf("%d",&N),j=N;memset(a,0,sizeof(a))){
| ^~~~~~
main.c:1:43: note: include '<string.h>' or provide a declaration of 'memset'
main.c:2:9: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
2 | for(getchar(),i=0;(j=getchar())!='\n';i++)if(j=='M')a[i%N]++;else if(j-'L')a[N]+=a[i%N]+1,a[i%N]=0;else a[i%N]+=a[N]+1,a[N]=0;
| ^~~~~~~
main.c:2:9: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:3:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
3 | for(i=0;i<N;printf("%d ",a[i++])for(j=N-1;j>i;j--)if(a[j]<a[j-1])a[j-1]^=a[j],a[j]^=a[j-1],a[j-1]^=a[j];
| ^~~~~~
main.c:3:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:3:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:3:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:3:37: error: expected ')' before 'for'
3 | for(i=0;i<N;printf("%d ",a[i++])for(j=N-1;j>i;j--)if(a[j]<a[j-1])a[j-1]^=a[j],a[j]^=a[j-1],a[j-1]^=a[j];
| ~ ^~~
| )
main.c:5:1: error: expected expression before '}' token
5 | }}
| ^
|
s235251115 | p00275 | C++ | import java.io.*;
import java.math.*;
import java.util.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
char[] c;
String s;
int[] huda=new int[10];
int n;
int turn;
int field;
int i,j;
while(true){
turn = 0;
field= 0;
s = r.readLine();
n = Integer.parseInt(s);
if(n == 0) break;
for(i=0;i<n;i++) huda[i]=0;
s = r.readLine();
c = s.toCharArray();
for(i=0;i<100;i++){
switch(c[i]){
case 'M':
huda[turn]++;
break;
case 'S':
field += huda[turn] + 1;
huda[turn] = 0;
break;
case 'L':
huda[turn] += field + 1;
field = 0;
break;
}
if(turn+1 == n)
turn = 0;
else turn++;
}
Arrays.sort(huda,0,n-1);
for(i=0;i<n;i++) System.out.print(huda[i]+" ");
System.out.println(field);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.math.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.util.*;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:15: error: expected ':' before 'static'
6 | public static void main(String[] args) throws IOException{
| ^~~~~~~
| :
a.cc:6:33: error: 'String' has not been declared
6 | public static void main(String[] args) throws IOException{
| ^~~~~~
a.cc:6:42: error: expected ',' or '...' before 'args'
6 | public static void main(String[] args) throws IOException{
| ^~~~
a.cc:6:46: error: expected ';' at end of member declaration
6 | public static void main(String[] args) throws IOException{
| ^
| ;
a.cc:6:48: error: 'throws' does not name a type
6 | public static void main(String[] args) throws IOException{
| ^~~~~~
a.cc:49:2: error: expected ';' after class definition
49 | }
| ^
| ;
|
s017494653 | p00275 | C++ | import java.io.*;
import java.math.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
char[] c;
String s;
int[] huda=new int[10];
int n;
int turn;
int field;
int i,j;
while(true){
turn = 0;
field= 0;
s = r.readLine();
n = Integer.parseInt(s);
if(n == 0) break;
for(i=0;i<n;i++) huda[i]=0;
s = r.readLine();
c = s.toCharArray();
for(i=0;i<100;i++){
switch(c[i]){
case 'M':
huda[turn]++;
break;
case 'S':
field += huda[turn] + 1;
huda[turn] = 0;
break;
case 'L':
huda[turn] += field + 1;
field = 0;
break;
}
if(turn+1 == n)
turn = 0;
else turn++;
}
Arrays.sort(huda,0,n-1);
for(i=0;i<n;i++) System.out.print(huda[i]+" ");
System.out.println(field);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.math.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.util.*;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
5 | public class Main{
| ^~~~~~
|
s662931517 | p00275 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
while (cin >> N, N) {
vector<int> v(N, 0);
int ba = 0;
char c;
int k = 0;
for (int i=0; i<100; ++i) {
cin >> c;
if (c == 'M') {
++ v[k];
} else if (c == 'S') {
ba += 1 + v[k];
v[k] = 0;
} else {
v[k] += 1 + ba;
ba = 0;
}
k = (k + 1) % N;
}
sort(v.begin(), v.end());
for (int i=0; i<N; ++i) {
cout << v[i] << " ";
}
cout << ba << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:9: error: 'sort' was not declared in this scope; did you mean 'short'?
25 | sort(v.begin(), v.end());
| ^~~~
| short
|
s166225945 | p00275 | C++ | #include<iostream>
#include<cstdio>
#include<string>
int N;
string ss;
int P[10],B;
int main()
{
while(true){
scanf("%d",&N);
if(N==0)break;
for(int i=0;i<N;i++)P[i]=0;
B=0;
cin >> ss;
for(int i=0;i<ss.length();i++){
if(ss[i]=='S'){
B+=(P[i%N]+1);
P[i%N]=0;
}
else if(ss[i]=='L'){
P[i%N]+=(B+1);
B=0;
}
else{
P[i%N]++;
}
}
for(int i=0;i<N;i++)printf("%d ",P[i]);
printf("%d\n",B);
}
return 0;
} | a.cc:5:1: error: 'string' does not name a type; did you mean 'stdin'?
5 | string ss;
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:14:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
14 | cin >> ss;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:14:9: error: 'ss' was not declared in this scope
14 | cin >> ss;
| ^~
|
s247361617 | p00275 | C++ | #include<iostream>
using namespace std;
int main(){
int n;
while(cin>> n,n){
char huda[100];
for(int i=0;i<100;i++){
cin>> huda[i];
}
int player=0;
int score[10]={0};
int stage=0;
for(int i=0;i<100;i++){
if(huda[i]=='M'){
score[player]++;
}
else if(huda[i]=='S'){
stage+=score[player]+1;
score[player]=0;
}
else{
score[player]+=stage+1;
stage=0;
}
if(player==n-1) player=0;
else player++;
}
sort(score,score+n);
for(int i=0;i<n;i++){
cout<< score[i]<< " ";
}
cout<< stage<< endl;
}
} | a.cc: In function 'int main()':
a.cc:31:5: error: 'sort' was not declared in this scope; did you mean 'short'?
31 | sort(score,score+n);
| ^~~~
| short
|
s499222017 | p00275 | C++ | int main(){
int a, n, m[10], f = 0;
char c[100];
for(int i = 0; i < 10; i++) m[i] = 0;
while(1){
cin >> n;
if(n <= 1 || n >= 10) break;
for(int i = 0; i < 100; i++) cin >> c[i];
for(int j = 0; j <= 100/n; j++){
for(int k = 0; k < n; k++){
if(c[j*n+k] == 'M') m[k]++;
else if(c[j*n+k] == 'S') f += m[k]+1, m[k] = 0;
else if(c[j*n+k] == 'L') m[k] += f+1, f = 0;
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < n-1; j++){
if(m[j] > m[j+1]) a = m[j], m[j] = m[j+1], m[j+1] = a;
}
}
for(int i = 0; i < n; i++) cout << m[i] << " ";
cout << f << endl;
for(int i = 0; i < 10; i++) m[i] = 0;
f = 0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
6 | cin >> n;
| ^~~
a.cc:21:32: error: 'cout' was not declared in this scope
21 | for(int i = 0; i < n; i++) cout << m[i] << " ";
| ^~~~
a.cc:22:5: error: 'cout' was not declared in this scope
22 | cout << f << endl;
| ^~~~
a.cc:22:18: error: 'endl' was not declared in this scope
22 | cout << f << endl;
| ^~~~
|
s741066469 | p00275 | C++ | int main(){
int a, n, m[10], f = 0;
char c[100];
for(int i = 0; i < 10; i++) m[i] = 0;
while(1){
cin >> n;
if(n <= 1 || n >= 10) break;
for(int i = 0; i < 100; i++) cin >> c[i];
for(int j = 0; j <= 100/n; j++){
for(int k = 0; k < n; k++){
if(c[j*n+k] == 'M') m[k]++;
else if(c[j*n+k] == 'S') f += m[k]+1, m[k] = 0;
else if(c[j*n+k] == 'L') m[k] += f+1, f = 0;
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < n-1; j++){
if(m[j] > m[j+1]) a = m[j], m[j] = m[j+1], m[j+1] = a;
}
}
for(int i = 0; i < n; i++) cout << m[i] << " ";
cout << f << endl;
for(int i = 0; i < 10; i++) m[i] = 0;
f = 0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
6 | cin >> n;
| ^~~
a.cc:21:32: error: 'cout' was not declared in this scope
21 | for(int i = 0; i < n; i++) cout << m[i] << " ";
| ^~~~
a.cc:22:5: error: 'cout' was not declared in this scope
22 | cout << f << endl;
| ^~~~
a.cc:22:18: error: 'endl' was not declared in this scope
22 | cout << f << endl;
| ^~~~
|
s236804459 | p00275 | C++ | #include<iostream>
using namespace std;
int main(){
int n = 0, ba = 0;
char card;
while(1){
cin >> n;
if(n == 0){
break;
}
int temochi[n];
for(int i = 0 ; i < 100; i++ ){
cin >> card;
temochi[i % n];
if(card == 'M'){
temochi[i % n] ++;
}
else if(card == 'S'){
ba = ba + temochi[i % n] + 1;
temochi[i % n] = 0;
}
else{
temochi[i % n] = temochi[i % n] + ba + 1;
}
}
sort(temochi, temochi + n);
for(int i = 0 ; i < n; i++){
cout << temochi[i] << " ";
}
cout << ba << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:33:17: error: 'sort' was not declared in this scope; did you mean 'short'?
33 | sort(temochi, temochi + n);
| ^~~~
| short
a.cc:40:2: error: expected '}' at end of input
40 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s381026993 | p00275 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n = 0, ba = 0;
char card;
while(1){
cin >> n;
if(n == 0){
break;
}
int temochi[n];
for(int i = 0 ; i < 100; i++ ){
cin >> card;
temochi[i % n];
if(card == 'M'){
temochi[i % n] ++;
}
else if(card == 'S'){
ba = ba + temochi[i % n] + 1;
temochi[i % n] = 0;
}
else{
temochi[i % n] = temochi[i % n] + ba + 1;
}
}
sort(temochi, temochi + n);
for(int i = 0 ; i < n; i++){
cout << temochi[i] << " ";
}
cout << ba << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:41:2: error: expected '}' at end of input
41 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s832041156 | p00275 | C++ | #include<stdio.h>
#include<string.h>
int main()
{
int ba=0,pl[10]={0},n,i,j;
char yama[100];
while(1)
{
scanf("%d",&n);
if(n==0){break;}
gets(yama);
for(i=0;i<100;i++)
{
if(i%n==0){j=0;}
if(strcmp(yama[i],"M")==0){pl[j]++;}
if(strcmp(yama[i],"L")==0){pl[j]+=ba+1;ba=0;}
if(strcmp(yama[i],"S")==0){ba+=pl[j]+1;pl[j]=0;}
j++;
}
for(i=0;i<n;i++)
{
printf("%d ",pl[i]);
printf("%d",ba);
}
}
return 0;
}
//まぐろーりん離散数学
//アルゴリズムパズル | a.cc: In function 'int main()':
a.cc:11:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | gets(yama);
| ^~~~
| getw
a.cc:15:41: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
15 | if(strcmp(yama[i],"M")==0){pl[j]++;}
| ~~~~~~^
| |
| char
In file included from a.cc:2:
/usr/include/string.h:156:32: note: initializing argument 1 of 'int strcmp(const char*, const char*)'
156 | extern int strcmp (const char *__s1, const char *__s2)
| ~~~~~~~~~~~~^~~~
a.cc:16:41: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
16 | if(strcmp(yama[i],"L")==0){pl[j]+=ba+1;ba=0;}
| ~~~~~~^
| |
| char
/usr/include/string.h:156:32: note: initializing argument 1 of 'int strcmp(const char*, const char*)'
156 | extern int strcmp (const char *__s1, const char *__s2)
| ~~~~~~~~~~~~^~~~
a.cc:17:41: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
17 | if(strcmp(yama[i],"S")==0){ba+=pl[j]+1;pl[j]=0;}
| ~~~~~~^
| |
| char
/usr/include/string.h:156:32: note: initializing argument 1 of 'int strcmp(const char*, const char*)'
156 | extern int strcmp (const char *__s1, const char *__s2)
| ~~~~~~~~~~~~^~~~
|
s751384900 | p00275 | C++ | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
int n=0;
int i=0;
int j=0;
int k=0;
int a[12];
int m=0;
int sa=0;
string c;
string b;
b="MSL";
vector<int> v1[105];
cin>>n;
while(n!=0){
cin>>c;
memset(a,0,sizeof(a));
for(i=0;i<100;i++){
m=i%n;
if(c[i]==b[0]){
a[m]++;
}
if(c[i]==b[1]){
sa=sa+a[m]+1;
a[m]=0;
}
if(c[i]==b[2]){
a[m]=a[m]+sa+1;
sa=0;
}
}
for(i=0;i<n;i++){
v1[j].push_back(a[i]);
}
sort(v1[j].begin(),v1[j].end());
v1[j].push_back(sa);
sa=0;
j++;
cin>>n;
}
for(i=0;i<j;i++){
sa=v1[i].size();
for(k=0;k<sa-1;k++){
cout<<v1[i][k]<<" ";
}
cout<<v1[i][sa-1]<<endl;
}
} | a.cc: In function 'int main()':
a.cc:21:17: error: 'memset' was not declared in this scope
21 | memset(a,0,sizeof(a));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<algorithm>
+++ |+#include <cstring>
5 | using namespace std;
|
s357898854 | p00275 | C++ | using namespace std;
int main(){
while (true) {
int N;
cin >> N;
if (N == 0) break;
string c;
cin >> c;
int maisu[10];
for (int i = 0; i < N;i++) {
maisu[i] = 0;
}
int ba = 0;
int turn = 0;
for (int i = 0; i , c.size(); i++) {
if (c[i] == 'M')
maisu[turn]++;
else if (c[i] == 'S') {
maisu[turn]++;
ba += maisu[turn];
maisu[turn] = 0;
}
else {
maisu[turn]++;
maisu[turn] += ba;
ba = 0;
}
turn++;
turn %= N;
}
sort(maisu,maisu+N);
for (int i = 0; i < N; i++) {
cout << maisu[i] <<" ";
}
cout << ba <<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:17: error: 'cin' was not declared in this scope
7 | cin >> N;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:9:17: error: 'string' was not declared in this scope
9 | string c;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | using namespace std;
a.cc:10:24: error: 'c' was not declared in this scope
10 | cin >> c;
| ^
a.cc:33:9: error: 'sort' was not declared in this scope; did you mean 'short'?
33 | sort(maisu,maisu+N);
| ^~~~
| short
a.cc:35:17: error: 'cout' was not declared in this scope
35 | cout << maisu[i] <<" ";
| ^~~~
a.cc:35:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:9: error: 'cout' was not declared in this scope
37 | cout << ba <<endl;
| ^~~~
a.cc:37:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:22: error: 'endl' was not declared in this scope
37 | cout << ba <<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
|
s494484017 | p00275 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
while(true) {
int N;
cin >> N;
if(N == 0) break;
string c;
cin >> c;
int maisu[10];
for (int i = 0; i < c.size(); i++){
maisu[i] = 0;
}
int ba = 0;
int turn = 0;
for (int i = 0; i < c.size(); i++) {
if(c[i] == 'M') {
maisu[turn]++;
}
else if (c[i] == 'S') {
maisu[turn]++;
ba += maisu[turn];
maisu[turn] = 0;
}
else {
maisu[turn]++;
maisu[turn] += ba;
ba = 0;
}
turn ++;
turn %= N;
}
sort(maisu, maisu+N);
for(int i = 0; i < N; i++) {
cout << maisu[i] << " ";
}
cout << ba << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:45:2: error: expected '}' at end of input
45 | }
| ^
a.cc:7:12: note: to match this '{'
7 | int main() {
| ^
|
s680814202 | p00275 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
string Card;
int p[10]={0},N,f;
int main(){
while(1){
int c=0;
cin>>N;
if(N==0)break;
cin>>Card;
while(cnt < 100){
for(intj=0;j<N;j++,c++){
if(c>=100)break;
if(Card[c] =='M'){
p[j]++;
}
else if(Card[c]=='S'){
f+=1+p[j];
p[j] = 0;
}
else {
p[j]+=f+1;
f=0;
}
}
}
sort(p,p+N);
for(int i=0;i<N;i++){
cout<<p[i]<< " ";
p[i]=0;
}
cout<<f<<endl;
Card='\0';
field=0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
12 | while(cnt < 100){
| ^~~
| int
a.cc:13:17: error: 'intj' was not declared in this scope; did you mean 'int'?
13 | for(intj=0;j<N;j++,c++){
| ^~~~
| int
a.cc:13:24: error: 'j' was not declared in this scope
13 | for(intj=0;j<N;j++,c++){
| ^
a.cc:35:9: error: 'field' was not declared in this scope
35 | field=0;
| ^~~~~
|
s991907682 | p00275 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
string Card;
int p[10]={0},N,f;
int main(){
while(1){
int c=0;
cin>>N;
if(N==0)break;
cin>>Card;
while(cnt < 100){
for(int j=0;j<N;j++,c++){
if(c>=100)break;
if(Card[c] =='M'){
p[j]++;
}
else if(Card[c]=='S'){
f+=1+p[j];
p[j] = 0;
}
else {
p[j]+=f+1;
f=0;
}
}
}
sort(p,p+N);
for(int i=0;i<N;i++){
cout<<p[i]<< " ";
p[i]=0;
}
cout<<f<<endl;
Card='\0';
field=0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
12 | while(cnt < 100){
| ^~~
| int
a.cc:35:9: error: 'field' was not declared in this scope
35 | field=0;
| ^~~~~
|
s259563938 | p00275 | C++ | #include<iostream>
#include <stdio.h>
using namespace std;
void cal(int *tehuda, int *ba, char c){
switch(c){
case 'M':*tehuda++; break;
case 'S':*ba+=*tehuda;*tehuda = 0;break;
case 'L':*tehuda+=*ba;*ba = 0;break;
}
int main(){
while(true){
int result[10] = {};
int n; cin >> n;
if(n == 1)return 0;
int player[10] ={};
int ba = 0;
for(int i =0; i < 100; i++){
char c;cin >> c;
cal(&player[i%n], &ba, c);
}
for(int i = 0;i<n-1;i++){
int top = player[i];
for(int j =1; j < n;j++){
if(top > player[j])top = player[j];
}
result[i] = top;
}
for(int i = 0; i < n; i++){
printf("%d ", result[i]);
}
cout << ba<<endl;
}
return 0;
} | a.cc: In function 'void cal(int*, int*, char)':
a.cc:10:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
10 | int main(){
| ^~
a.cc:10:9: note: remove parentheses to default-initialize a variable
10 | int main(){
| ^~
| --
a.cc:10:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:10:11: error: a function-definition is not allowed here before '{' token
10 | int main(){
| ^
a.cc:35:2: error: expected '}' at end of input
35 | }
| ^
a.cc:4:39: note: to match this '{'
4 | void cal(int *tehuda, int *ba, char c){
| ^
|
s313566533 | p00275 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
/*void sort(int* array, int index){
bool finish = true;
while(finish){
finish = false;
for(int i = 1; i < index; i++){
if(array[i - 1] > array[i]){
int temp = array[i - 1];
array[i - 1] = array[i];
array[i] = temp;
finish = true;
}
}
}
}*/
int main(void){
while(true){
int n;
cin >> n;
if(n == 0){
break;
}
int players[5];
for(int i = 0; i < n; i++){
players[i] = 0;
}
char deck[100];
cin >> deck;
int field = 0;
for(int i = 0; i < 100; i++){
if(deck[i] == 'S'){
field += players[i%n] + 1;
players[i%n] = 0;
}else if(deck[i] == 'M'){
players[i%n]++;
}else if(deck[i] == 'L'){
players[i%n]++;
players[i%n] += field;
field = 0;
}
}
sort(players, n);
for(int i = 0; i < n; i++){
cout << players[i] << ' ';
}
cout << field;
}
} | a.cc: In function 'int main()':
a.cc:46:13: error: no matching function for call to 'sort(int [5], int&)'
46 | sort(players, n);
| ~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: template argument deduction/substitution failed:
a.cc:46:13: note: deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
46 | sort(players, n);
| ~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
|
s961061767 | p00275 | C++ | #include<iostream>
using namesoace std;
int main(){
int N;
cin>>N;
int player[N+1];
int all;
int num=1;
for(int i=1;i<101;i++){
char x;
cin>>x;
if(x=='M'){
player[num]+=1;
num++;
if(num=>6){
num=1;
}
}
if(x=='S'){
all+=player[num];
player[num]=0;
num++;
if(num=>6){
num=1;
}
}
if(x=='L'){
player[num]+=1+all;
all=0;
num++;
if(num=>6){
num=1;
}
}
}
for(int i=1;i<N+1;i++){
cout<<player[i]<<" ";
}
cout<<all<<endl;
} | a.cc:2:7: error: expected nested-name-specifier before 'namesoace'
2 | using namesoace std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin>>N;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:16:32: error: expected primary-expression before '>' token
16 | if(num=>6){
| ^
a.cc:24:32: error: expected primary-expression before '>' token
24 | if(num=>6){
| ^
a.cc:32:32: error: expected primary-expression before '>' token
32 | if(num=>6){
| ^
a.cc:38:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
38 | cout<<player[i]<<" ";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:40:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
40 | cout<<all<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:40:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
40 | cout<<all<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s718436571 | p00275 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
while(true){
int N;
cin>>N;
if(N==0)break;
int n[10]=[0];
int m=0;
for(int i=0;i<100;i++){
char c;
cin>>c;
n[i%N]++;
if(c=='S'){
m+=n[i%N];
n[i%N]=0;
}else if(c=='L'){
n[i%N]+=m;
m=0;
}
}
sort(n,n+N);
for(int i=0;i<N;i++){
cout<<n[i]<<' ';
}
cout<<m<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:20: error: expected identifier before numeric constant
12 | int n[10]=[0];
| ^
a.cc: In lambda function:
a.cc:12:22: error: expected '{' before ';' token
12 | int n[10]=[0];
| ^
a.cc: In function 'int main()':
a.cc:12:19: error: array must be initialized with a brace-enclosed initializer
12 | int n[10]=[0];
| ^~~
|
s830348987 | p00275 | C++ | #include<stdio.h>
#include<conio.h>
#include<algorithm>
using namespace std ;
int main()
{
int n ;
while( 1 )
{
scanf( "%d" ,&n ) ;
if( n == 0 )
{
return 0 ;
}
int player[ 10 ] = { 0 } ;
int ba = 0 ;
int i = 0 ;
while( i < 100 )
{
int p = i % n ;
switch( getch() )
{
case 'L' :
player[ p ] += ba ;
ba = 0 ;
case 'M' :
++player[ p ] ;
break ;
default :
ba += player[ p ] + 1 ;
player[ p ] = 0 ;
}
++i ;
}
sort( player ,player + n ) ;
i = 0 ;
while( n-- )
{
printf( "%d " ,player[ i++ ] ) ;
}
printf( "%d\n" ,ba ) ;
}
} | a.cc:2:9: fatal error: conio.h: No such file or directory
2 | #include<conio.h>
| ^~~~~~~~~
compilation terminated.
|
s476131132 | p00275 | C++ | //
// main.cpp
// pck2013
//
// Created by Wanikawa on 2013/09/14.
// Copyright (c) 2013年 Wanikawa. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
int main()
{
/*
hitogagominoyouda
*/
while (1) {
int num,feeld = 0;
int play[10] = {0};
string crad;
cin >> num;
if (num == 0) break;
cin >> crad;
//cout << crad;
int pt = 0;
while (pt < 100) {
for (int i = 0; i < num; i++) {
if (pt > 100) break;
if (crad[pt] == 'M') {
play[i]++;
}
if (crad[pt] == 'S') {
feeld++;
feeld += play[i];
play[i] = 0;
}
if (crad[pt] == 'L') {
play[i] = play[i] + feeld + 1;
feeld = 0;
}
pt++;
}
}
vector<int> p;
for (int i = 0; i < num; i++) {
p.push_back(play[i]);
}
sort(p.begin(), p.end());
for (int i = 0; i < num; i++) {
cout << p[i] << " ";
}
cout << feeld << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:52:9: error: 'sort' was not declared in this scope; did you mean 'short'?
52 | sort(p.begin(), p.end());
| ^~~~
| short
|
s506384362 | p00275 | C++ | #include<stdio.h>
int main(void)
{
int n,a,i,pl=1,fl=0;
int p[101]={0};
char s;
while(0==0){
scanf("%d",&n);
if(n==0)break;
for(i==0;i<100;i++){
scanf("%c",&s);
if(s =='S'){
fl+=p[pl]+1;
p[pl]=0;
}else if(s =='M')p[pl]+=1;
else if(s =='L'){
p[pl]+=fl+1;
fl=0;
}
pl++;
if(pl>n)pl=1;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
25 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s994566378 | p00275 | C++ | #define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
using namespace std;
typedef long long ll;
typedef pair<int,string> P;
static const double EPS = 1e-8;
int main(){
int N;
while(~scanf("%d",&N)){
if(N == 0) break;
char cards[101];
scanf("%s",cards);
int card_idx = 0;
int players[11];
memset(players.0,sizeof(players));
int field = 0;
for(int round=0;round < 100; round++){
for(int player_idx=0;player_idx < N; player_idx++){
if(cards[card_idx] == 'M'){
players[player_idx]++;
}
else if(cards[card_idx] == 'S'){
field += player_idx[player_idx] + 1;
player_idx[player_idx] = 0;
}
else if(cards[card_idx] == 'L'){
player_idx[player_idx] += field + 1;
}
card_idx++;
}
}
sort(players,players + N);
for(int i=0;i<N;i++){
printf("%d ",players[player_idx]);
}
printf("%d\n",field);
}
} | a.cc: In function 'int main()':
a.cc:35:19: error: expected ')' before numeric constant
35 | memset(players.0,sizeof(players));
| ~ ^~
| )
a.cc:35:11: error: too few arguments to function 'void* memset(void*, int, size_t)'
35 | memset(players.0,sizeof(players));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstring:43,
from a.cc:13:
/usr/include/string.h:61:14: note: declared here
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ^~~~~~
a.cc:44:30: error: invalid types 'int[int]' for array subscript
44 | field += player_idx[player_idx] + 1;
| ^
a.cc:45:21: error: invalid types 'int[int]' for array subscript
45 | player_idx[player_idx] = 0;
| ^
a.cc:48:21: error: invalid types 'int[int]' for array subscript
48 | player_idx[player_idx] += field + 1;
| ^
a.cc:56:28: error: 'player_idx' was not declared in this scope; did you mean 'players'?
56 | printf("%d ",players[player_idx]);
| ^~~~~~~~~~
| players
|
s624655478 | p00275 | C++ | #define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
using namespace std;
typedef long long ll;
typedef pair<int,string> P;
static const double EPS = 1e-8;
int main(){
int N;
while(~scanf("%d",&N)){
if(N == 0) break;
char cards[101];
scanf("%s",cards);
int card_idx = 0;
int players[11];
memset(players.0,sizeof(players));
int field = 0;
for(int round=0;round < 100; round++){
for(int player_idx=0;player_idx < N; player_idx++){
if(cards[card_idx] == 'M'){
players[player_idx]++;
}
else if(cards[card_idx] == 'S'){
field += player_idx[player_idx] + 1;
player_idx[player_idx] = 0;
}
else if(cards[card_idx] == 'L'){
player_idx[player_idx] += field + 1;
}
card_idx++;
}
}
sort(players,players + N);
for(int i=0;i<N;i++){
printf("%d ",players[player_idx]);
}
printf("%d\n",field);
}
} | a.cc: In function 'int main()':
a.cc:35:19: error: expected ')' before numeric constant
35 | memset(players.0,sizeof(players));
| ~ ^~
| )
a.cc:35:11: error: too few arguments to function 'void* memset(void*, int, size_t)'
35 | memset(players.0,sizeof(players));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstring:43,
from a.cc:13:
/usr/include/string.h:61:14: note: declared here
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ^~~~~~
a.cc:44:30: error: invalid types 'int[int]' for array subscript
44 | field += player_idx[player_idx] + 1;
| ^
a.cc:45:21: error: invalid types 'int[int]' for array subscript
45 | player_idx[player_idx] = 0;
| ^
a.cc:48:21: error: invalid types 'int[int]' for array subscript
48 | player_idx[player_idx] += field + 1;
| ^
a.cc:56:28: error: 'player_idx' was not declared in this scope; did you mean 'players'?
56 | printf("%d ",players[player_idx]);
| ^~~~~~~~~~
| players
|
s372778900 | p00275 | C++ | #include<iostream>
using namespace std;
int main(){
int n,have[110],stage,turn,tmp;
char c[110];
while(1){
cin >> n;
if(n==0) break;
stage=0;
memset(have,0,sizeof(have));
cin << c;
for(int i=0,turn=0;i<100;i++,turn++){
if(turn>=n) turn=0;
if(c[i]=='M'){ //男の場合。
have[turn]++;
}
else if(c[i]=='S'){ //坊主の場合。
stage+=have[turn]+1;
have[turn]=0;
}
else if(c[i]=='L'){ //姫の場合。
have[turn]+=stage+1;
stage=0;
}
}
//ソート
for(int i=0;i<n;i++){
for(int j=n-1;j>i;j--){
if(have[j]<have[j-1]){
tmp=have[j];
have[j]=have[j-1];
have[j-1]=tmp;
}
}
}
for(int i=0;i<n;i++){
cout << have[i];
if(i==n-1) cout << endl;
else cout << " ";
}
}
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
10 | memset(have,0,sizeof(have));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:11:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'char [110]')
11 | cin << c;
| ~~~ ^~ ~
| | |
| | char [110]
| std::istream {aka std::basic_istream<char>}
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/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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:11:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
11 | cin << c;
| ^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = char [110]]':
a.cc:11:12: required from here
11 | cin << c;
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
|
s717025958 | p00275 | C++ | #include<iostream>
using namespace std;
int main(){
int n,have[110],stage,turn,tmp;
char c[110];
while(1){
cin >> n;
if(n==0) break;
stage=0;
memset(have,0,sizeof(have));
cin << c;
for(int i=0,turn=0;i<100;i++,turn++){
if(turn>=n) turn=0;
if(c[i]=='M'){ //男の場合。
have[turn]++;
}
else if(c[i]=='S'){ //坊主の場合。
stage+=have[turn]+1;
have[turn]=0;
}
else if(c[i]=='L'){ //姫の場合。
have[turn]+=stage+1;
stage=0;
}
}
//ソート
for(int i=0;i<n;i++){
for(int j=n-1;j>i;j--){
if(have[j]<have[j-1]){
tmp=have[j];
have[j]=have[j-1];
have[j-1]=tmp;
}
}
}
for(int i=0;i<n;i++){
cout << have[i] << " ";
if(i==n-1) cout << stage << endl;
}
}
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
10 | memset(have,0,sizeof(have));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:11:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'char [110]')
11 | cin << c;
| ~~~ ^~ ~
| | |
| | char [110]
| std::istream {aka std::basic_istream<char>}
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/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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:11:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
11 | cin << c;
| ^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin << c;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = char [110]]':
a.cc:11:12: required from here
11 | cin << c;
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
|
s383293635 | p00276 | Java | import java.util.*;
public class mon6{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int R = 0;
R = scan.nextInt();
for(int k = 1;k<=R;k++){
int count = 0;
int C = scan.nextInt();
int A = scan.nextInt();
int N = scan.nextInt();
while(true){
if(N != 0 && A != 0 && C != 0){
count = count + 1;
C = C - 1;
A = A - 1;
N = N - 1;
}else
if(A != 0 && C >= 2){
count = count + 1;
C = C - 2;
A = A - 1;
}else
if(C >= 3){
count = count + 1;
C = C - 3;
}else
if(C <= 2){
break;
}
}
System.out.println(count);
}
}
} | Main.java:3: error: class mon6 is public, should be declared in a file named mon6.java
public class mon6{
^
1 error
|
s481018319 | p00276 | C | 4
3 0 0
1 1 1
9 4 1
0 1 2 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 4
| ^
|
s140546783 | p00276 | C | #include <stdio.h>
int main (void)
{
int a;
scanf("%d",&a);
int b[100][3]={};
int i;
int j;
int k=0;
for(i=0;i<a;i++){
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
int b2[3]={};
int c=0;
b2[0]=b[i][0];
b2[1]=b[i][1];
b2[2]=b[i][2];
while(1){
b2[0]-=1;
b2[1]-=1;
b2[2]-=1;
if(b2[0]<0||b2[1]<0||b2[2]<0)
break;
c++;
while(1){
b2[0]-=2;
b2[1]-=1;
if(b2[0]<0||b2[1]<0)
break;
c++;
}
while(1){
b2[0]-=3;
if(b2[0]<0)
break;
c++;
}
printf("%d\n",c);
}
return 0;
} | main.c: In function 'main':
main.c:50:1: error: expected declaration or statement at end of input
50 | }
| ^
|
s388238822 | p00276 | C | #include <stdio.h>
int main(void)
{
int i,ii,y,c,a,n,sum,ans;
scanf("%d",&y);
for(i=0;i<y;i++){
scanf("%d%d%d",&c,&a,&n);
if(c==0){
printf("0\n");
}else{
sum=c+a+n;
for(ii=0;ii<c;ii++){
sum=sum-3;
if(sum>0){
ans++;
}else break
}
printf("%d\n",ans);
}
}
return 0;
} | main.c: In function 'main':
main.c:17:44: error: expected ';' before '}' token
17 | }else break
| ^
| ;
18 | }
| ~
|
s564031600 | p00276 | C | #define m(a,b)(a<b?a:b)
r;main(c,a,n){for(gets(&c);r=~scanf("%d%d%d",&c,&a,&n);printf("%d\n",r+n+(c-n*2)/3))r=m(c,m(a,n)),c-=r,a-=r,n=min(c/2,a);} | main.c:2:1: warning: data definition has no type or storage class
2 | r;main(c,a,n){for(gets(&c);r=~scanf("%d%d%d",&c,&a,&n);printf("%d\n",r+n+(c-n*2)/3))r=m(c,m(a,n)),c-=r,a-=r,n=min(c/2,a);}
| ^
main.c:2:1: error: type defaults to 'int' in declaration of 'r' [-Wimplicit-int]
main.c:2:3: error: return type defaults to 'int' [-Wimplicit-int]
2 | r;main(c,a,n){for(gets(&c);r=~scanf("%d%d%d",&c,&a,&n);printf("%d\n",r+n+(c-n*2)/3))r=m(c,m(a,n)),c-=r,a-=r,n=min(c/2,a);}
| ^~~~
main.c: In function 'main':
main.c:2:3: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:2:3: error: type of 'a' defaults to 'int' [-Wimplicit-int]
main.c:2:3: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:2:19: error: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
2 | r;main(c,a,n){for(gets(&c);r=~scanf("%d%d%d",&c,&a,&n);printf("%d\n",r+n+(c-n*2)/3))r=m(c,m(a,n)),c-=r,a-=r,n=min(c/2,a);}
| ^~~~
main.c:2:31: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
2 | r;main(c,a,n){for(gets(&c);r=~scanf("%d%d%d",&c,&a,&n);printf("%d\n",r+n+(c-n*2)/3))r=m(c,m(a,n)),c-=r,a-=r,n=min(c/2,a);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define m(a,b)(a<b?a:b)
main.c:2:31: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
2 | r;main(c,a,n){for(gets(&c);r=~scanf("%d%d%d",&c,&a,&n);printf("%d\n",r+n+(c-n*2)/3))r=m(c,m(a,n)),c-=r,a-=r,n=min(c/2,a);}
| ^~~~~
main.c:2:31: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:2:56: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
2 | r;main(c,a,n){for(gets(&c);r=~scanf("%d%d%d",&c,&a,&n);printf("%d\n",r+n+(c-n*2)/3))r=m(c,m(a,n)),c-=r,a-=r,n=min(c/2,a);}
| ^~~~~~
main.c:2:56: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:56: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:2:56: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:111: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
2 | r;main(c,a,n){for(gets(&c);r=~scanf("%d%d%d",&c,&a,&n);printf("%d\n",r+n+(c-n*2)/3))r=m(c,m(a,n)),c-=r,a-=r,n=min(c/2,a);}
| ^~~
| main
|
s756897507 | p00276 | C++ | #include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef pair<int,int> P;
const int INF = 1000000000;
int c,a,n;
int main(){
int q;
scanf("%d",&q);
rep(i,n){
scanf("%d%d%d",&c,&a,&n);
int ans = 0,temp;
temp = min(c,min(a,n));
ans += temp;
a-=temp;
c-=temp;
temp = min(c/2,a);
ans += temp;
a -= temp;
ans + = c/3;
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:33:23: error: expected primary-expression before '=' token
33 | ans + = c/3;
| ^
|
s082751251 | p00276 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include <time.h>
using namespace std ;
int main()
{
int N ,c,a,n ;
vector< int > ans;
cin >> N ;
ans.assign( N, 0) ;
for( int i = 0 ; i < N ; ++i )
{
cin >> c >> a >> n ;
if(c <= a && c <= n)
{
ans[i] += c ;
c = 0 ;
}
else if(a > n && c > n)
{
ans[i] += n ;
c -= n ;
a -= n ;
}
else if( n > a && c > a )
{
ans[i] += a ;
c -= a ;
a = 0 ;
}
if(a != 0)
{
if(a <= c / 2)
{
ans[i] += a ;
c -= a * 2 ;
}
else
{
ans[i] += c / 2 ;
c = 0 ;
}
}
ans[i] += c / 3 ;
for(int i = 0; i < N; ++i){
cout << ans[i]<<endl;
}
}
return 0 ;
} | a.cc: In function 'int main()':
a.cc:11:3: error: 'vector' was not declared in this scope
11 | vector< int > ans;
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include<algorithm>
+++ |+#include <vector>
3 | #include<string>
a.cc:11:11: error: expected primary-expression before 'int'
11 | vector< int > ans;
| ^~~
a.cc:13:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
13 | ans.assign( N, 0) ;
| ^~~
| abs
|
s308300661 | p00276 | C++ | #include <iostream>
using namespace std;
int main(){
int Q;
cin>>Q;
for(int i=0;i<Q;i++){
int c,a,n,can=0,cca=0,ccc=0;
cin>>c>>a>>n;
for(int j=0;j<c;j++){
if(1<=n&&1<=a&&1<=c){
can=n;
a=a-n; c=c-n; n=0;
}
if(1<=a&&1<=c/2){
cca=a;
c=c-a*2; a=0
}
if(1<=c/3){
ccc=c/3; c=0;
}
}
cout<<can+cca+ccc<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:21: error: expected ';' before '}' token
16 | c=c-a*2; a=0
| ^
| ;
17 | }
| ~
|
s754534859 | p00276 | C++ | #include <iostream>
using namespace std;
int main(){
int Q;
cin>>Q;
for(int i=0;i<Q;i++){
int c,a,n,can=0,cca=0,ccc=0;
cin>>c>>a>>n;
if(1<=n&&1<=a&&1<=c){
can=n;
a=a-n; c=c-n; n=0;
}
else if(1<=a&&1<=c/2){
cca=a;
c=c-a*2; a=0;
}
else if(1<=c/3){
ccc=c/3; c=0;
}
}
cout<<can+cca+ccc<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:11: error: 'can' was not declared in this scope; did you mean 'scanf'?
23 | cout<<can+cca+ccc<<endl;
| ^~~
| scanf
a.cc:23:15: error: 'cca' was not declared in this scope
23 | cout<<can+cca+ccc<<endl;
| ^~~
a.cc:23:19: error: 'ccc' was not declared in this scope
23 | cout<<can+cca+ccc<<endl;
| ^~~
a.cc: At global scope:
a.cc:25:3: error: expected unqualified-id before 'return'
25 | return 0;
| ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
26 | }
| ^
|
s018269312 | p00276 | C++ | #include<iostream>
#include<algorithm>
int mymin(int a, int b, int c) {
int tmp = min(a, b);
return min(tmp, c);
}
using namespace std;
int main() {
int q;
cin >> q;
for (int i = 0; i < q; i++) {
int c, a, n, ct = 0;
cin >> c >> a >> n;
ct += mymin( c ,a ,n );
c -= ct, a -= ct, n -= ct;
if (a > 0 && c > 0 && a * 2 > c)ct += (c / 2);
else if (a > 0 && c > 0 && a * 2 < c)ct += (a + ((c - a * 2) / 3));
cout << ct << endl;
}
return 0;
} | a.cc: In function 'int mymin(int, int, int)':
a.cc:5:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
5 | int tmp = min(a, b);
| ^~~
| std::min
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s356086107 | p00276 | C++ | #include<iostream>
#include<queue>
using namespace std;
struct Team{
int c;
int a;
int n;
int TeamNum;
Team(){
c=0;
a=0;
n=0;
TeamNum=0;
}
};
void Clear(Team& a,Team& b){
a.c = b.c;
a.a = b.a;
a.n = b.n;
a.TeamNum = b.TeamNum;
}
int main(){
int Q = 0;
cin >> Q;
for(int i=0; i<Q; i++){
int c,a,n;
cin >> c >> a >> n;
if(c == 0 || (c < 2 && a == 0) || (c == 0 && a == 0 && n == 0))
int answer = 0;
queue<Team> que;
while(!que.empty()){
que.pop();
}
Team tmp;
tmp.c = c;
tmp.a = a;
tmp.n = n;
tmp.TeamNum = 0;
que.push(tmp);
while(!que.empty()){
tmp = que.front();
que.pop();
if(tmp.c < 0 || tmp.a < 0 || tmp.n < 0){
tmp.TeamNum--;
if(answer < tmp.TeamNum){
answer = tmp.TeamNum;
}
continue;
}
tmp.TeamNum += 1;
Team beforetmp;
Clear(beforetmp,tmp);
tmp.c -= 3;
que.push(tmp);
Clear(tmp,beforetmp);
tmp.c -= 2;
tmp.a -= 1;
que.push(tmp);
Clear(tmp,beforetmp);
tmp.c--;
tmp.a--;
tmp.n--;
que.push(tmp);
}
cout << answer << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:62:16: error: 'answer' was not declared in this scope
62 | if(answer < tmp.TeamNum){
| ^~~~~~
a.cc:95:17: error: 'answer' was not declared in this scope
95 | cout << answer << endl;
| ^~~~~~
|
s817692995 | p00276 | C++ | #include<iostream>
#include<queue>
using namespace std;
struct Team{
int c;
int a;
int n;
int TeamNum;
Team(){
c=0;
a=0;
n=0;
TeamNum=0;
}
};
void Clear(Team& a,Team& b){
a.c = b.c;
a.a = b.a;
a.n = b.n;
a.TeamNum = b.TeamNum;
}
int main(){
int Q = 0;
cin >> Q;
for(int i=0; i<Q; i++){
int c,a,n;
cin >> c >> a >> n;
if(c == 0 || (c < 2 && a == 0) || (c == 0 && a == 0 && n == 0)){
cout << 0 << end;
continue;
}
int answer = 0;
queue<Team> que;
while(!que.empty()){
que.pop();
}
Team tmp;
tmp.c = c;
tmp.a = a;
tmp.n = n;
tmp.TeamNum = 0;
que.push(tmp);
while(!que.empty()){
tmp = que.front();
que.pop();
if(tmp.c < 0 || tmp.a < 0 || tmp.n < 0){
tmp.TeamNum--;
if(answer < tmp.TeamNum){
answer = tmp.TeamNum;
}
continue;
}
tmp.TeamNum += 1;
Team beforetmp;
Clear(beforetmp,tmp);
tmp.c -= 3;
que.push(tmp);
Clear(tmp,beforetmp);
tmp.c -= 2;
tmp.a -= 1;
que.push(tmp);
Clear(tmp,beforetmp);
tmp.c--;
tmp.a--;
tmp.n--;
que.push(tmp);
}
cout << answer << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:38:21: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
38 | cout << 0 << end;
| ~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
|
s736813905 | p00276 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int Q;
cijn>>Q;
for(int i=0;i<Q;i++){
int c,a,n;
cin>>c>>a>>n;
int can=min(min(c,a),n);
c-=can;
a-=can;
int cca=min(c/2,a);
c-=cca*2;
int ccc=c/3;
cout<<can+cca+ccc<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'cijn' was not declared in this scope
7 | cijn>>Q;
| ^~~~
|
s061925976 | p00276 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int N;
cin>>N;
for(int i=0;i<100;i++){
int c,a,n;
int can=min(min(c,a),n);
c-=can;
a-=can;
int cca=min(c?2,a);
c-=cca*2;
int ccc=c/3;
cout<<can+cca+ccc<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:42: error: expected ':' before ')' token
16 | int cca=min(c?2,a);
| ^
| :
a.cc:16:42: error: expected primary-expression before ')' token
|
s067434468 | p00276 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int Q;
cin>>Q;
for(int i=0;i<Q;i++){
int c,a,n;
int can=min(min(c,a),n);
c-=can;
a-=can;
int cca=min(c?2,a);
c-=cca*2;
int ccc=c/3;
cout<<can+cca+ccc<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:42: error: expected ':' before ')' token
16 | int cca=min(c?2,a);
| ^
| :
a.cc:16:42: error: expected primary-expression before ')' token
|
s523059319 | p00276 | C++ | #include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
int Q;
int can[3];
int total,temp;
scanf("%d",&Q);
for(int i = 0; i < Q; i++){
total = INT_MAX;
for(int j = 0; j < 3; j++){
scanf("%d",&can[j]);
if(total > can[j])
total = can[j];
}
for(int j = 0; j< 3; j++)
can[j] -= total;
temp = min(can[0]/2,can[1]);
total += temp;
can[0] -= temp*2;
can[1] -= temp;
total += can[0]/3;
printf("%d\n",total);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:25: error: 'INT_MAX' was not declared in this scope
15 | total = INT_MAX;
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <functional>
+++ |+#include <climits>
5 | using namespace std;
|
s826923611 | p00277 | Java | 00.05 sec 18484 KB 122 lines 1798 bytes 2014-10-17 22:00
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import java.util.*;
class MyComp implements Comparator<Pair> {
public int compare(Pair arg0, Pair arg1) {
Pair t0 = (Pair) arg0;
Pair t1 = (Pair) arg1;
if(t0.time > t1.time) {
return -1;
}
else if(t0.time < t1.time) {
return 1;
}
else {
if(t0.id > t1.id) {
return 1;
}
else if(t0.id < t1.id) {
return -1;
}
else {
return 0;
}
}
}
}
class Pair {
int id;
int time;
public Pair(int d, int t) {
this.id = d;
this.time = t;
}
public Pair(Pair a) {
this.id = a.id;
this.time = a.time;
}
}
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
PriorityQueue <Pair> queA = new PriorityQueue <Pair>(11,new MyComp());
PriorityQueue <Pair> queBX = new PriorityQueue <Pair>(11,new MyComp());
int N = stdIn.nextInt();
int R = stdIn.nextInt();
int L = stdIn.nextInt();
int[] time = new int[100000];
int lastTime = 0;
queA.add(new Pair(1,0);
for(int i = 0; i < R; i++) {
int d = stdIn.nextInt();
int t = stdIn.nextInt();
int x = stdIn.nextInt();
time[queA.peek().id-1] += t - lastTime;
boolean atta = false;
while(!queA.isEmpty()) {
Pair tmp = queA.poll();
if(tmp.id == d) {
atta = true;
tmp.time += x;
queBX.offer(tmp);
break;
}
else {
queBX.offer(tmp);
}
}
if(!atta) {
queBX.offer(new Pair(d,x));
}
while(!queBX.isEmpty()) {
queA.offer(queBX.poll());
}
lastTime = t;
}
time[queA.peek().id-1] += L - lastTime;
int timeA = 0;
int idA = 0;
for(int i = 0; i < time.length; i++) {
if(timeA < time[i]) {
timeA = time[i];
idA = i;
}
}
System.out.println(idA+1);
}
} | Main.java:1: error: class, interface, enum, or record expected
00.05 sec 18484 KB 122 lines 1798 bytes 2014-10-17 22:00
^
Main.java:187: error: ')' or ',' expected
queA.add(new Pair(1,0);
^
2 errors
|
s327183768 | p00277 | Java | 00.05 sec 18484 KB 122 lines 1798 bytes 2014-10-17 22:00
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import java.util.*;
class MyComp implements Comparator<Pair> {
public int compare(Pair arg0, Pair arg1) {
Pair t0 = (Pair) arg0;
Pair t1 = (Pair) arg1;
if(t0.time > t1.time) {
return -1;
}
else if(t0.time < t1.time) {
return 1;
}
else {
if(t0.id > t1.id) {
return 1;
}
else if(t0.id < t1.id) {
return -1;
}
else {
return 0;
}
}
}
}
class Pair {
int id;
int time;
public Pair(int d, int t) {
this.id = d;
this.time = t;
}
public Pair(Pair a) {
this.id = a.id;
this.time = a.time;
}
}
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
PriorityQueue <Pair> queA = new PriorityQueue <Pair>(11,new MyComp());
PriorityQueue <Pair> queBX = new PriorityQueue <Pair>(11,new MyComp());
int N = stdIn.nextInt();
int R = stdIn.nextInt();
int L = stdIn.nextInt();
int[] time = new int[100000];
int lastTime = 0;
for(int i = 0; i < R; i++) {
int d = stdIn.nextInt();
int t = stdIn.nextInt();
int x = stdIn.nextInt();
queA.add(new Pair(1,0));
time[queA.peek().id-1] += t - lastTime;
boolean atta = false;
while(!queA.isEmpty()) {
Pair tmp = queA.poll();
if(tmp.id == d) {
atta = true;
tmp.time += x;
queBX.offer(tmp);
break;
}
else {
queBX.offer(tmp);
}
}
if(!atta) {
queBX.offer(new Pair(d,x));
}
while(!queBX.isEmpty()) {
queA.offer(queBX.poll());
}
lastTime = t;
}
time[queA.peek().id-1] += L - lastTime;
int timeA = 0;
int idA = 0;
for(int i = 0; i < time.length; i++) {
if(timeA < time[i]) {
timeA = time[i];
idA = i;
}
}
System.out.println(idA+1);
}
} | Main.java:1: error: class, interface, enum, or record expected
00.05 sec 18484 KB 122 lines 1798 bytes 2014-10-17 22:00
^
1 error
|
s471314551 | p00277 | Java | va.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
private void run() {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int R = scanner.nextInt();
int L = scanner.nextInt();
int[] P = new int[N];
int[] T = new int[N];
int PT = 0;
int n1 = 0;
for (int i = 0; i < R; i++) {
int d = scanner.nextInt() - 1;
int t = scanner.nextInt();
int x = scanner.nextInt();
P[d] += x;
if (x > 0) {
if (P[d] > P[n1] || (P[d] == P[n1] && n1 > d)) {
T[n1] += t - PT + 1;
PT = t;
n1 = d;
}
}
if (x < 0) {
if (d != n1)
continue;
int n2 = n1, p2 = P[d];
for (int j = N - 1; j >= 0; j--) {
if (p2 <= P[j]) {
n2 = j;
p2 = P[j];
}
}
if (n2 != n1) {
T[n1] += t - PT + 1;
PT = t;
n1 = n2;
}
}
}
T[n1] += L - PT + 1;
int ans_n = 0, ans_t = 0;
for (int i = 0; i < N; i++) {
if (ans_t < T[i]) {
ans_t = T[i];
ans_n = i;
}
}
System.out.println(ans_n + 1);
}
} | Main.java:1: error: class, interface, enum, or record expected
va.util.Scanner;
^
1 error
|
s828808992 | p00277 | Java | public class Main {
/** ???????????????° */
public static int TEAM_AMOUNT;
/** ???¬????????????° */
public static long RECORD_AMOUNT;
/** ???????????????????????? */
public static long CONTEST_TIME;
public static void main(String[] args) throws IOException {
// ??\???????????????
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// ????????????°??????¬????????????°???????????????????????????????????´?
setPremise(br.readLine().split(" "));
// ??????????????????????????????¨??????°????????´???????????????????????????????N??? 0:??????° 1:????????????
long[][] teams = new long[TEAM_AMOUNT][2];
// ??????¨?????????§??????°???¨?????????????????´????????????? 0:????????? 1:??????°
long[] maxScoreTeam = new long[2];
// ??????¨?????????????????´?????????????°
long now = 0;
// ????????????°???¨
// if ("stop".equals(strs)) {
// break;
// }
for (int i = 0; i < RECORD_AMOUNT; i++) {
long[] record = convertToLongs(br.readLine().split(" "));
if (now < record[1]) {
// ???????????????????????????????????????????????????
teams[(int) maxScoreTeam[0]][1] += record[1] - now;
// ????????????´???°??????
now = record[1];
}
// ??????????????????????????????°????????????
teams[(int) record[0]][0] += record[2];
// ??????§????????????´?????????´?????????°????????\????????????
setMaxScore(teams, (int) record[0], record[2], maxScoreTeam);
}
// ??????¨?????????~?????????????????????§??????????????????§??????????????????????????????
teams[(int) maxScoreTeam[0]][1] += CONTEST_TIME - now;
// ??????????????????
long maxShowTime = 0;
// ????????????????????????-1???
int winner = -1;
for (int i = 0; i < teams.length; i++) {
if (teams[i][1] > maxShowTime) {
maxShowTime = teams[i][1];
winner = i + 1;
}
}
System.out.println(winner);
}
public static void setPremise(String[] strs) {
TEAM_AMOUNT = Integer.parseInt(strs[0]);
RECORD_AMOUNT = Long.parseLong(strs[1]);
CONTEST_TIME = Long.parseLong(strs[2]);
}
public static long[] convertToLongs(String[] strs) {
long[] record = new long[3];
// ?????????ID
record[0] = Long.parseLong(strs[0]) - 1;
// ????????????
record[1] = Long.parseLong(strs[1]);
// ????????????°
record[2] = Long.parseLong(strs[2]);
return record;
}
/**
* ?????? ????????????????????????????????????????????????????????????°????????´???????
*
* @param teams
* @param pointGetter
* @param point
* @param maxScoreTeam
*/
private static void setMaxScore(long[][] teams, int pointGetter, long point, long[] maxScoreTeam) {
// ????????????´???
// ?????????????????????????????????????????????§?????????´???
if (maxScoreTeam[1] < teams[pointGetter][0]) {
setMaxScoreTeam(teams, pointGetter, maxScoreTeam);
return;
} else if (maxScoreTeam[1] == teams[pointGetter][0] && maxScoreTeam[0] > pointGetter) {
// ????????????????????\???????????????§??????????????????¨????????????????????????????????????
setMaxScoreTeam(teams, pointGetter, maxScoreTeam);
return;
} else if (maxScoreTeam[0] == pointGetter && point < 0) {
long max = 0;
int team = 0;
for (int i = 0; i < teams.length; i++) {
if (teams[i][0] > max) {
max = teams[i][0];
team = i;
}
}
// ?????????????????????
maxScoreTeam[0] = team;
// ????????????
maxScoreTeam[1] = max;
return;
}
return;
}
/**
* ?????? ?????????§?????????¢?????????????????¨??????????
*
* @param teams
* @param pointGetter
* @param maxScoreTeam
*/
private static void setMaxScoreTeam(long[][] teams, int pointGetter, long[] maxScoreTeam) {
maxScoreTeam[0] = pointGetter;
maxScoreTeam[1] = teams[pointGetter][0];
}
} | Main.java:9: error: cannot find symbol
public static void main(String[] args) throws IOException {
^
symbol: class IOException
location: class Main
Main.java:12: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:12: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:12: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class InputStreamReader
location: class Main
4 errors
|
s147521642 | p00277 | Java | import java.util.*;
public class mondai7 {
public static void main(String[] args){
int n, l, r, d, t = 0, x = 0, kiroku = 0, max =0, maxban = 0,max2 = 0, hensu = 0;
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
int[] ten = new int[n];
int[] byou = new int[n];
r = scan.nextInt();
l = scan.nextInt();
for(int i = 0; i < r; i++){
d = scan.nextInt();
t = scan.nextInt();
x = scan.nextInt();
if(i == 0){
kiroku = t;
byou[0] = t;
}
ten[d-1] = ten[d-1] + x;
//maxbanのひとつまえを入力
for(int j = 1; j < n; j++){
if(max < ten[j]){
max = ten[j];
maxban = j;
}
}
byou[maxban] = byou[maxban] + t - kiroku;
kiroku = t;
hensu = d;
}
byou[hensu - 1] = byou[hensu - 1] + (l - t);
for(int k = 1; k < n; k++){
if(byou[max2] < byou[k]){
max2 = k;
}
}
System.out.println(max2 + 1);
}
} | Main.java:3: error: class mondai7 is public, should be declared in a file named mondai7.java
public class mondai7 {
^
1 error
|
s325613125 | p00277 | Java | import java.util.*;
public class mondai7 {
public static void main(String[] args){
int n, l, r, d, p= 0, t = 0, x = 0, kiroku = 0, max =0, max2 = 0, hensu = 0;
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
int[] ten = new int[n];
int[] byou = new int[n];
r = scan.nextInt();
int[] ban = new int[r];
l = scan.nextInt();
for(int i = 0; i < r; i++){
d = scan.nextInt();
t = scan.nextInt();
x = scan.nextInt();
if(i == 0){
kiroku = t;
byou[0] = t;
}
ten[d-1] = ten[d-1] + x;
//maxbanのひとつまえを入力
for(int j = 1; j < n; j++){
if(ten[max] < ten[j]){
max = j;
}
}
ban[p] = max;
if(i > 0){
byou[ban[p-1]] = byou[ban[p-1]] + t - kiroku;
}
kiroku = t;
hensu = max;
max = 0;
p = p + 1;
}
byou[hensu] = byou[hensu] + (l - t);
for(int k = 1; k < n; k++){
if(byou[max2] < byou[k]){
max2 = k;
}
}
System.out.println(max2 + 1);
}
} | Main.java:3: error: class mondai7 is public, should be declared in a file named mondai7.java
public class mondai7 {
^
1 error
|
s858901976 | p00277 | C | #include <stdio.h>
int time[1000000];
int main(void)
{
int n, r, l;
int i;
int before_time = 0;
int longest = 0;
scanf("%d %d %d", &n, &r, &l);
for (i = 0; i < r; i++){
int d, t, x;
scanf("%d %d %d", &d, &t, &x);
time[d - 1] += t - before_time;
before_time = t;
}
time[d - 1] += 600 - t;
for (i = 1; i < n; i++){
if (time[longest] < time[i]){
longest = i;
}
}
printf("%d\n", longest + 1);
return 0;
} | main.c: In function 'main':
main.c:20:14: error: 'd' undeclared (first use in this function)
20 | time[d - 1] += 600 - t;
| ^
main.c:20:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:30: error: 't' undeclared (first use in this function)
20 | time[d - 1] += 600 - t;
| ^
|
s469735893 | p00277 | C | #include <stdio.h>
int time[1000000];
int main(void)
{
int n, r, l;
int i;
int before_time = 0;
int longest = 0;
scanf("%d %d %d", &n, &r, &l);
for (i = 0; i < r; i++){
int d, t, x;
scanf("%d %d %d", &d, &t, &x);
time[d - 1] += t - before_time;
before_time = t;
}
time[d - 1] += 600 - before_time;
for (i = 1; i < n; i++){
if (time[longest] < time[i]){
longest = i;
}
}
printf("%d\n", longest + 1);
return 0;
} | main.c: In function 'main':
main.c:20:14: error: 'd' undeclared (first use in this function)
20 | time[d - 1] += 600 - before_time;
| ^
main.c:20:14: note: each undeclared identifier is reported only once for each function it appears in
|
s675884518 | p00277 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,r,l;
int d[100001],t[100001],x[1000001];
int i,j,flg,max,min;
int a[1000001]={0},b[1000001]={0};
int main(void)
{
cin>>n>>r>>l;
flg=0;
for(i=1;i<=r;i++){
cin>>d[i]>>t[i]>>x[i];
if(x[i]<0){
flg=1,b[d[i]]=x[i],x[i]=0;
}
}
if(flg==0){
for(j=r;j>0;j--){
if(j==r) a[n]+=l-t[r],b[n]+=x[r];
if(j+1<=r){
a[d[j]]+=t[j+1]-t[j],b[d[j]]+=x[j];
}
}
}
if(flg==1){
for(j=0;j<r;j++){
if(j+1<=r){
b[d[j]]+=x[j];
}
}
}
max=-1,min=1000010;
for(i=1;i<=n;i++){
if(max<a[i]&&min>i) min=i;
}
cout<<min<<endl;
}
| a.cc: In function 'int main()':
a.cc:37:9: error: reference to 'max' is ambiguous
37 | max=-1,min=1000010;
| ^~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:13: note: 'int max'
5 | int i,j,flg,max,min;
| ^~~
a.cc:37:16: error: reference to 'min' is ambiguous
37 | max=-1,min=1000010;
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: '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:5686:5: note: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:17: note: 'int min'
5 | int i,j,flg,max,min;
| ^~~
a.cc:39:20: error: reference to 'max' is ambiguous
39 | if(max<a[i]&&min>i) min=i;
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:13: note: 'int max'
5 | int i,j,flg,max,min;
| ^~~
a.cc:39:30: error: reference to 'min' is ambiguous
39 | if(max<a[i]&&min>i) min=i;
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: '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:5686:5: note: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:17: note: 'int min'
5 | int i,j,flg,max,min;
| ^~~
a.cc:39:37: error: reference to 'min' is ambiguous
39 | if(max<a[i]&&min>i) min=i;
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: '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:5686:5: note: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:17: note: 'int min'
5 | int i,j,flg,max,min;
| ^~~
a.cc:41:15: error: reference to 'min' is ambiguous
41 | cout<<min<<endl;
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: '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:5686:5: note: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:17: note: 'int min'
5 | int i,j,flg,max,min;
| ^~~
|
s798220550 | p00277 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
struct dat{ int id, point; };
#define SIZE 1 << 17
int N, R, L;
int res[MAX_N + 1];
dat seg[SIZE * 2 - 1];
int n;
void init(){
n = 1;
while(n < N) n *= 2;//nはseg木の要素数
for(int i = 0; i < 2 * n - 1; i++) seg[i].point = 0;
for(int j = 0; j <= N; j++){
seg[n + j].id = j;
}
}
void add(int p, int x){
p += n;
seg[p].point += x;
while(p > 0){
//printf("p = %d\n", p);
p = (p - 1) / 2;
if(seg[p * 2 + 1].point >= seg[p * 2 + 2].point){
seg[p] = seg[p * 2 + 1];
}
else{
seg[p] = seg[p * 2 + 2];
}
}
}
int main(){
scanf("%d%d%d", &N, &R, &L);
init();
int lb = 0;//左端
int d, t, x;
for(int i = 0; i < R; i++){
scanf("%d%d%d", &d, &t, &x);
if(i > 0) res[seg[0].id] += t - lb;
add(d, x);
lb = t;
//for(int i = 1; i <= N; i++){
// printf("%d ", res[i]);
//}
//printf(": seg[0].id = %d\n", seg[0].id);
}
res[seg[0].id] += L - t;
int longest = 0;//最長の映り時間
for(int i = 1; i <= N; i++) longest = max(longest, res[i]);
for(int i = 1; i <= N; i++){
if(res[i] == longest){
printf("%d\n", i);
return 0;
}
}
} | a.cc:9:9: error: 'MAX_N' was not declared in this scope
9 | int res[MAX_N + 1];
| ^~~~~
a.cc:6:16: warning: left shift count >= width of type [-Wshift-count-overflow]
6 | #define SIZE 1 << 17
| ^
a.cc:10:9: note: in expansion of macro 'SIZE'
10 | dat seg[SIZE * 2 - 1];
| ^~~~
a.cc: In function 'int main()':
a.cc:46:27: error: 'res' was not declared in this scope
46 | if(i > 0) res[seg[0].id] += t - lb;
| ^~~
a.cc:54:9: error: 'res' was not declared in this scope
54 | res[seg[0].id] += L - t;
| ^~~
|
s213657774 | p00277 | C++ | #include <iostream>
#include <map>
#define INF (2 << 28)
using namespace std;
typedef pair<int, int> iiP;
int n;
iiP seg[2 * 100001 - 1];
void init(int q){
n = 1;
while(n < q) n *= 2;
for(int i = 0; i < n; i++) seg[i] = iiP(-INF, -i);
}
void update(int i, iiP a){
i += n - 1;
seg[i] = a;
while(i > 0){
i = (i - 1) / 2;
seg[i] = max(seg[i * 2 + 1], seg[i * 2 + 2]);
}
}
int main(){
int N, R, L, d, t, x, prev;
int sumt[100001] = {0}, score[100001] = {0};
cin >> N >> R >> L;
init(N);
cin >> d >> t >> x;
sumt[1] += t, score[d] += x;
update(d, iiP(score[d], -d));
prev = t;
// cout << ":" << score[d] << " " << d << endl;
for(int i = 1; i < R; i++){
cin >> d >> t >> x;
iiP p = seg[0];
score[d] += x, sumt[-p.second] += t - prev;
prev = t;
//cout << ":" << score[d] << " " << d << endl;
update(d, iiP(score[d], -d));
}
iiP p = seg[0];
// cout << p.first << " " << -p.second << endl;
sumt[-p.second] += L - prev;
cout << max_element(sumt + 1, sumt + N + 1) - sumt << endl;
} | a.cc: In function 'int main()':
a.cc:57:11: error: 'max_element' was not declared in this scope
57 | cout << max_element(sumt + 1, sumt + N + 1) - sumt << endl;
| ^~~~~~~~~~~
|
s787330995 | p00277 | C++ | #include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define MP make_pair
#define F first
#define S second
typedef pair<int, int> P;
int N, R, L;
int point[100005];
int res[100005];
int main(){
scanf("%d%d%d", &N, &R, &L);
int now = 0;
memset(point, 0, sizeof(point));
memset(res, 0, sizeof(res));
priority_queue<P>q;
rep(i, N) q.push(P(0, -i));
rep(i, R){
// printf("%d\n", i);
int d, t, x;
scanf("%d%d%d", &d, &t, &x);d--;
// printf("%d %d %d\n", d, t, x);
// printf("%d\n", i);
P p = q.top(); q.pop();
while(p.F != point[-p.S]){
p = q.top(); q.pop();
}
q.push(p);
res[-p.S] += t - now;
now = t;
point[d] += x;
// printf("%d\n", d);
// rep(j, N) printf("%d ", point[j]); puts("");
q.push(P(point[d], -d));
}
P p = q.top(); q.pop();
while(p.F != point[-p.S]){
// printf("%d %d\n", p.F, point[-p.S]);
p = q.top(); q.pop();
}
// printf("%d %d\n", p.F, point[-p.S]);
res[-p.S] += L - now;
// rep(i, N) printf("%d ", res[i]); puts("");
int team = 0;
rep(i, N) if(res[team] < res[i]) team = i;
printf("%d\n", team+1);
exit(0);
return (0);
} | a.cc: In function 'int main()':
a.cc:23:3: error: 'memset' was not declared in this scope
23 | memset(point, 0, sizeof(point));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <algorithm>
+++ |+#include <cstring>
5 |
|
s974719568 | p00277 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define MP make_pair
#define F first
#define S second
typedef pair<int, int> P;
int N, R, L;
int point[100005];
int res[100005];
int main(){
scanf("%d%d%d", &N, &R, &L);
int now = 0;
memset(point, 0, sizeof(point));
memset(res, 0, sizeof(res));
priority_queue<P>q;
rep(i, N) q.push(P(0, -i));
rep(i, R){
// printf("%d\n", i);
int d, t, x;
scanf("%d%d%d", &d, &t, &x);d--;
// printf("%d %d %d\n", d, t, x);
// printf("%d\n", i);
P p = q.top(); q.pop();
while(p.F != point[-p.S]){
p = q.top(); q.pop();
}
q.push(p);
res[-p.S] += t - now;
now = t;
point[d] += x;
// printf("%d\n", d);
// rep(j, N) printf("%d ", point[j]); puts("");
q.push(P(point[d], -d));
}
P p = q.top(); q.pop();
while(p.F != point[-p.S]){
// printf("%d %d\n", p.F, point[-p.S]);
p = q.top(); q.pop();
}
// printf("%d %d\n", p.F, point[-p.S]);
res[-p.S] += L - now;
// rep(i, N) printf("%d ", res[i]); puts("");
int team = 0;
rep(i, N) if(res[team] < res[i]) team = i;
printf("%d\n", team+1);
exit(0);
return (0);
} | a.cc: In function 'int main()':
a.cc:24:3: error: 'memset' was not declared in this scope
24 | memset(point, 0, sizeof(point));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <algorithm>
+++ |+#include <cstring>
6 |
|
s792083230 | p00277 | C++ |
import java.util.*;
class MyComp implements Comparator<Pair> {
public int compare(Pair arg0, Pair arg1) {
Pair t0 = (Pair) arg0;
Pair t1 = (Pair) arg1;
if(t0.time > t1.time) {
return -1;
}
else if(t0.time < t1.time) {
return 1;
}
else {
if(t0.id > t1.id) {
return 1;
}
else if(t0.id < t1.id) {
return -1;
}
else {
return 0;
}
}
}
}
class Pair {
int id;
int time;
public Pair(int d, int t) {
this.id = d;
this.time = t;
}
public Pair(Pair a) {
this.id = a.id;
this.time = a.time;
}
}
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
PriorityQueue <Pair> queA = new PriorityQueue <Pair>(11,new MyComp());
PriorityQueue <Pair> queBX = new PriorityQueue <Pair>(11,new MyComp());
int N = stdIn.nextInt();
int R = stdIn.nextInt();
int L = stdIn.nextInt();
int[] time = new int[100000];
int lastTime = 0;
queA.add(new Pair(1,0));
for(int i = 0; i < R; i++) {
int d = stdIn.nextInt();
int t = stdIn.nextInt();
int x = stdIn.nextInt();
time[queA.peek().id-1] += t - lastTime;
boolean atta = false;
while(!queA.isEmpty()) {
Pair tmp = queA.poll();
if(tmp.id == d) {
atta = true;
tmp.time += x;
queBX.offer(tmp);
break;
}
else {
queBX.offer(tmp);
}
}
if(!atta) {
queBX.offer(new Pair(d,x));
}
while(!queBX.isEmpty()) {
queA.offer(queBX.poll());
}
lastTime = t;
}
time[queA.peek().id-1] += L - lastTime;
int timeA = 0;
int idA = 0;
for(int i = 0; i < time.length; i++) {
if(timeA < time[i]) {
timeA = time[i];
idA = i;
}
}
System.out.println(idA+1);
}
} | a.cc:2:1: error: 'import' does not name a type
2 | import java.util.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:25: error: expected initializer before 'Comparator'
4 | class MyComp implements Comparator<Pair> {
| ^~~~~~~~~~
a.cc:36:11: error: expected ':' before 'Pair'
36 | public Pair(int d, int t) {
| ^~~~~
| :
a.cc:40:11: error: expected ':' before 'Pair'
40 | public Pair(Pair a) {
| ^~~~~
| :
a.cc:40:12: error: invalid constructor; you probably meant 'Pair (const Pair&)'
40 | public Pair(Pair a) {
| ^~~~
a.cc:45:2: error: expected ';' after class definition
45 | }
| ^
| ;
a.cc: In constructor 'Pair::Pair(int, int)':
a.cc:37:14: error: request for member 'id' in '(Pair*)this', which is of pointer type 'Pair*' (maybe you meant to use '->' ?)
37 | this.id = d;
| ^~
a.cc:38:14: error: request for member 'time' in '(Pair*)this', which is of pointer type 'Pair*' (maybe you meant to use '->' ?)
38 | this.time = t;
| ^~~~
a.cc: At global scope:
a.cc:47:1: error: expected unqualified-id before 'public'
47 | public class Main {
| ^~~~~~
|
s201585195 | p00277 | C++ | n, r, l = map(int, input().split())
point, time = [], []
rev = {0: []}
for i in range(n):
point.append(0)
time.append(0)
rev[0].append(i)
now, tv, tmax = 0, 0, 0
for i in range(r):
d, t, x = map(int, input().split())
time[tv] += t - now
now = t
m = point[d-1]
rev[point[d-1]].remove(d-1)
point[d-1] += x
if point[d-1] in rev:
rev[point[d-1]].append(d-1)
else:
rev[point[d-1]] = [d-1]
if tv != d-1:
if point[tv] == point[d-1]:
tv = min(tv, d-1)
elif point[tv] < point[d-1]:
tv = d-1
elif x < 0:
if rev[m] != []:
tv = min(rev[m])
else:
tv = min(rev[max(point)])
time[tv] += l - now
m = max(time)
i = 0
while True:
if time[i] == m:
print(i+1)
break
i += 1 | a.cc:1:1: error: 'n' does not name a type
1 | n, r, l = map(int, input().split())
| ^
a.cc:4:1: error: expected unqualified-id before 'for'
4 | for i in range(n):
| ^~~
|
s062538940 | p00277 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#define REP(i,n) for(int i = 0; i < n; i++)
#define REP(j,n) for(int j = 0; j < n; j++)
using namespace std;
typedef pair<int, int> P;
int main() {
int n,r,l;
cin >> n;
cin >> r;
cin >> l;
int list[n+1];
int time[n+1];
memset(list, 0, (n+1)*4);
memset(time, 0, (n+1)*4);
int top = 0;
int id = 1;
int nowtime = 0;
int timemax = 0;
int timemaxid = 0;
for(int i = 0; i < r; i++) {
int d,t,x;
cin >> d;
cin >> t;
cin >> x;
time[id] += t - nowtime;
if(time[id] > timemax) {
timemax = time[id];
timemaxid = id;
}
nowtime = t;
list[d] += x;
if(id == d) {
top += x;
}
if(x < 0 && d == id) {
for(int j = 1; j < n+1; j++) {
if(top < list[j] || (top == list[j] && j < id)) {
top = list[j];
id = j;
}
}
}
if(x > 0 && d != id) {
if(top < list[d] || (top == list[d] && d < id)) {
top = list[d];
id = d;
}
}
}
time[id] += l - nowtime;
if(time[id] > timemax) {
timemax = time[id];
timemaxid = id;
}
cout << timemaxid << "\n";
} | a.cc:12:9: warning: "REP" redefined
12 | #define REP(j,n) for(int j = 0; j < n; j++)
| ^~~
a.cc:11:9: note: this is the location of the previous definition
11 | #define REP(i,n) for(int i = 0; i < n; i++)
| ^~~
a.cc: In function 'int main()':
a.cc:24:5: error: 'memset' was not declared in this scope
24 | memset(list, 0, (n+1)*4);
| ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
10 | #include <algorithm>
+++ |+#include <cstring>
11 | #define REP(i,n) for(int i = 0; i < n; i++)
|
s922085401 | p00277 | C++ | #include<iostream>
#include<cstring>
#include<map>
using namespace std;
#define MAX 1111111
#define MIN -1111111
typedef pair<int,int> P;
void init(int n);
void update(int k,int x);
P maxx(int k1,int k2);
P dat[2*100000];
int tim[100001]={0};
int N;
int main(){
int R,L;
cin >> N >> R >> L;
int n_tmp = N;
init(N);
memset(tim,0,n_tmp+1);
int now = 0;
dat[0]=P(MIN,1);
for(int i=0;i<R;i++){
int d,t,x;
cin >> d >> t >> x;
tim[dat[0].second] += t - now;
update(d,x);
now = t;
}
tim[dat[0].second] += L - now;
int *ans = max_element(tim,tim+n_tmp+1);
cout << ans - tim << endl;
}
void init(int n){
N=1;
while(N<n) N*=2;
for(int i=0;i<2*N-1;i++){
dat[i]=P(MIN,MAX);
}
for(int i=N-1;i<N-1+n;i++){
dat[i]=P(0,i-(N-2));
}
return;
}
void update(int k,int x){
k += N - 2;
//cout << k << " " << x << endl;
P p = dat[k];
int score = p.first;
int team = p.second;
cout << score << " " << team << endl;
dat[k] = P(score+x,team);
while(k > 0){
k = (k - 1) / 2;
dat[k] = maxx(k*2+1,k*2+2);
//cout << dat[k].first << " " << dat[k].second << endl;
}
return;
}
P maxx(int k1,int k2){
P p;
if(dat[k1].first == dat[k2].first){
p = P(dat[k1].first,min(dat[k1].second,dat[k2].second));
}
else {
p = max(dat[k1],dat[k2]);
}
return p;
} | a.cc: In function 'int main()':
a.cc:31:14: error: 'max_element' was not declared in this scope
31 | int *ans = max_element(tim,tim+n_tmp+1);
| ^~~~~~~~~~~
|
s939868124 | p00277 | C++ | #include<bits/stdc++.h>
using namespace std;
pair<int,int> rmq[1111111111111];
int N,R,L;
int d[1111111]={0};
int t[1111111]={0};
int x[1111111]={0};
int team[11111111]={0};
void updata(int k,int x){
int no=k;
k += N-1;
rmq[k].first += x;
rmq[k].second = k;
while(k > 0){
k = (k - 1) / 2;
if(rmq[k*2+1].first > rmq[k*2+2].first){
rmq[k] = rmq[k*2+1];
}
else if(rmq[k*2+1].first < rmq[k*2+2].first){
rmq[k] = rmq[k*2+2];
}
else if(rmq[k*2+1].second < rmq[k*2+2].second){
rmq[k] = rmq[k*2+1];
}
else{
rmq[k] = rmq[k*2+2];
}
}
return;
}
int main(){
for(int i=0;i<1111111;i++){
rmq[i].first = 0;
rmq[i].second = 0;
}
int smp=0;
int now=0;
int now1=0;
cin >> N >> R >> L;
for(int i=0;i<R;i++){
smp = rmq[0].second;
cin >> d[i] >> t[i] >> x[i];
updata(d[i],x[i]);
if(smp != rmq[0].second){
team[smp-2] += t[i] - now;
if(t[i] != t[i+1]){
now = t[i];
}
}
smp = rmq[0].second;
}
team[smp-2] += L - now;
int a=0;
int ans=0;
for(int i=1;i<=N;i++){
//cout<<team[i]<<endl;
if(a < team[i]){
ans = i;
a = team[i];
}
}
cout << ans << endl;
} | /tmp/ccQjQPos.o: in function `updata(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccQjQPos.o
/tmp/ccQjQPos.o: in function `main':
a.cc:(.text+0x2b6): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x2d2): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x2e7): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x31b): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x347): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x36c): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x38e): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x3a5): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x3d7): relocation truncated to fit: R_X86_64_PC32 against symbol `team' defined in .bss section in /tmp/ccQjQPos.o
a.cc:(.text+0x3ee): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s244500577 | p00277 | C++ | #include<bits/stdc++.h>
using namespace std;
pair<int,int> rmq[1111111111111];
int N,R,L;
int d[1111111]={0};
int t[1111111]={0};
int x[1111111]={0};
int team[11111111]={0};
void updata(int k,int x){
int no=k;
k += N-1;
rmq[k].first += x;
rmq[k].second = k;
while(k > 0){
k = (k - 1) / 2;
if(rmq[k*2+1].first > rmq[k*2+2].first){
rmq[k] = rmq[k*2+1];
}
else if(rmq[k*2+1].first < rmq[k*2+2].first){
rmq[k] = rmq[k*2+2];
}
else if(rmq[k*2+1].second < rmq[k*2+2].second){
rmq[k] = rmq[k*2+1];
}
else{
rmq[k] = rmq[k*2+2];
}
}
return;
}
int main(){
for(int i=0;i<1111111;i++){
rmq[i].first = 0;
rmq[i].second = 0;
}
int smp=0;
int now=0;
int now1=0;
cin >> N >> R >> L;
for(int i=0;i<R;i++){
smp = rmq[0].second;
cin >> d[i] >> t[i] >> x[i];
updata(d[i],x[i]);
if(smp != rmq[0].second){
team[smp-2] += t[i] - now;
if(t[i] != t[i+1]){
now = t[i];
}
}
smp = rmq[0].second;
}
team[smp-2] += L - now;
int a=0;
int ans=0;
for(int i=1;i<=N;i++){
//cout<<team[i]<<endl;
if(a < team[i]){
ans = i;
a = team[i];
}
}
cout << ans << endl;
} | /tmp/ccrgfrAU.o: in function `updata(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccrgfrAU.o
/tmp/ccrgfrAU.o: in function `main':
a.cc:(.text+0x2b6): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x2d2): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x2e7): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x31b): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x347): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x36c): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x38e): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x3a5): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x3d7): relocation truncated to fit: R_X86_64_PC32 against symbol `team' defined in .bss section in /tmp/ccrgfrAU.o
a.cc:(.text+0x3ee): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s551644265 | p00277 | C++ | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
void update(int k,int x);
pair<int, int> seg[1 << 18];
int main(){
int n,r,l;
int d,t,x;
int i;
int team[1000];
int sento=0,watch=0,maxi=0;
scanf("%d %d %d",&n,&r,&l);
for(i=0;i<n;i++) update(i,0);
for(i=0;i<r;i++){
scanf("%d %d %d",&d,&t,&x);
team[sento]+=t-watch;
update(d-1,x);
sento=seg[0].second-1;
watch=t;
}
team[sento]+=l-watch;
for (int i=1;i<n;i++){
if(team[maxi]<team[i]) maxi=i;
}
printf("%d\n",maxi+1);
return 0;
}
void update(int k,int x){
int id;
id=k+1;
k += (1 << 17) - 1;
seg[k].first+=x;
seg[k].second=id;
while(k){
k=(k-1)/2;
if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
else if(seg[k * 2 + 1].first < seg[k * 2 + 2].first) seg[k] = seg[k * 2 + 2];
else seg[k] = seg[k * 2 + 1];
}
return ;
} | a.cc: In function 'void update(int, int)':
a.cc:55:24: error: no match for 'operator>' (operand types are 'int' and 'std::pair<int, int>')
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~
| | |
| int std::pair<int, int>
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: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:55:34: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string: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:55:34: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/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:55:34: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: 'std::pair<int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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: template argument deduction/substitution failed:
a.cc:55:34: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:55:34: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:55:34: note: mismatched types 'const _CharT*' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:55:34: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
|
s433372745 | p00277 | C++ | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
void update(int k,int x);
pair<int, int> seg[1 << 18];
int main(){
int n,r,l;
int d,t,x;
int i;
int team[1000];
int sento=0,watch=0,maxi=0;
scanf("%d %d %d",&n,&r,&l);
for(i=0;i<n;i++) update(i,0);
for(i=0;i<r;i++){
scanf("%d %d %d",&d,&t,&x);
team[sento]+=t-watch;
update(d-1,x);
sento=seg[0].second-1;
watch=t;
}
team[sento]+=l-watch;
for (int i=1;i<n;i++){
if(team[maxi]<team[i]) maxi=i;
}
printf("%d\n",maxi+1);
return 0;
}
void update(int k,int x){
int id;
id=k+1;
k += (1 << 17) - 1;
seg[k].first+=x;
seg[k].second=id;
while(k){
k=(k-1)/2;
if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
else if(seg[k * 2 + 1].first < seg[k * 2 + 2].first) seg[k] = seg[k * 2 + 2];
else seg[k] = seg[k * 2 + 1];
}
return;
} | a.cc: In function 'void update(int, int)':
a.cc:55:24: error: no match for 'operator>' (operand types are 'int' and 'std::pair<int, int>')
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~
| | |
| int std::pair<int, int>
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: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:55:34: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string: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:55:34: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/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:55:34: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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:55:34: note: 'std::pair<int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/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: template argument deduction/substitution failed:
a.cc:55:34: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:55:34: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:55:34: note: mismatched types 'const _CharT*' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:55:34: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int'
55 | if(seg[k*2+1].first>seg[k*2+2]) seg[k]=seg[k*2+1];
| ^
|
s596085120 | p00277 | C++ | #include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef pair<int,int> P;
const int INF = 1000000000;
int main(){
/*
int N,R,L;
int n,t,s;
int nowN=-1,befT=0,maxS;
static int scr[114514],time[114514];
scanf("%d%d%d",&N,&R,&L);
rep(i,R){
maxS=-INF;
scanf("%d%d%d",&n,&t,&s);
if(nowN>-1)time[nowN]+=t-befT;
scr[n-1]+=s;
rep(i,N)maxS=max(scr[i],maxS);
rep(i,N)if(scr[i]==maxS){nowN=i;break;}
befT=t;
}
maxS=-INF;
t=L;
time[nowN]+=t-befT;
rep(i,N)maxS=max(time[i],maxS);
rep(i,N)if(time[i]==maxS){nowN=i;break;}
printf("%d\n",nowN+1);
return 0;*/
int N,R,L;
int n,t,s;
int nowN=-1,befT=0,maxS;
static int scr[114514],time[114514];
scanf("%d%d%d",&N,&R,&L);
rep(i,R){
maxS=-INF;
scanf("%d%d%d",&n,&t,&s);
if(nowN>-1)time[nowN]+=t-befT;
scr[n-1]+=s;
nowN = (scr[n-1]==scr[nowN]?min(n-1,nowN):scr[n-1]>scr[nowN]>n-1:nowN);
befT=t;
}
maxS=-INF;
t=L;
time[nowN]+=t-befT;
nowN = (time[n-1]==time[nowN]?min(n-1,nowN):time[n-1]>time[nowN]>n-1:nowN);
printf("%d\n",nowN+1);
return 0;
} | a.cc: In function 'int main()':
a.cc:46:81: error: expected ')' before ':' token
46 | nowN = (scr[n-1]==scr[nowN]?min(n-1,nowN):scr[n-1]>scr[nowN]>n-1:nowN);
| ~ ^
| )
a.cc:52:85: error: expected ')' before ':' token
52 | nowN = (time[n-1]==time[nowN]?min(n-1,nowN):time[n-1]>time[nowN]>n-1:nowN);
| ~ ^
| )
|
s551107002 | p00277 | C++ | #include<iostream>
#include<queue>
using namespace std;
#define MAX_N 100000000
#define MAX_TEAM 10000000
priority_queue<pair<int, int>> Q;
int d[MAX_N], n, s, L, x[MAX_N], y[MAX_N], t[MAX_N], d[MAX_TEAM], ti[MAX_TEAM];
int main() {
cin >> n >> s >> L;
Q.push(make_pair(0, -1000000000));
x[0] = 0; t[0] = 0; y[0] = 0; x[s + 1] = 0; t[s + 1] = L; y[s + 1] = 0;
for (int i = 1; i <= s + 1; i++) {
if (i <= s) { cin >> x[i] >> t[i] >> y[i]; }
d[x[i]] += y[i];
Q.push(make_pair(d[x[i]], -x[i]));
while (true) {
pair<int, int>p = Q.top();
if (p.first == d[-p.second]) {
ti[p.second] += x[i] - x[i - 1]; break;
}
Q.pop();
}
}
} | a.cc:9:54: error: conflicting declaration 'int d [10000000]'
9 | int d[MAX_N], n, s, L, x[MAX_N], y[MAX_N], t[MAX_N], d[MAX_TEAM], ti[MAX_TEAM];
| ^
a.cc:9:5: note: previous declaration as 'int d [100000000]'
9 | int d[MAX_N], n, s, L, x[MAX_N], y[MAX_N], t[MAX_N], d[MAX_TEAM], ti[MAX_TEAM];
| ^
|
s683833173 | p00277 | C++ | #include<iostream>
#include<queue>
using namespace std;
#define MAX_N 10000000
#define MAX_TEAM 10000000
priority_queue<pair<int, int>> Q;
int d[MAX_N], n, s, L, x[MAX_N], y[MAX_N], t[MAX_N], d[MAX_TEAM], ti[MAX_TEAM];
int main() {
cin >> n >> s >> L;
Q.push(make_pair(0, -1000000000));
x[0] = 0; t[0] = 0; y[0] = 0; x[s + 1] = 0; t[s + 1] = L; y[s + 1] = 0;
for (int i = 1; i <= s + 1; i++) {
if (i <= s) { cin >> x[i] >> t[i] >> y[i]; }
d[x[i]] += y[i];
Q.push(make_pair(d[x[i]], -x[i]));
while (true) {
pair<int, int>p = Q.top();
if (p.first == d[-p.second]) {
ti[p.second] += x[i] - x[i - 1]; break;
}
Q.pop();
}
}
} | a.cc:9:54: error: redefinition of 'int d [10000000]'
9 | int d[MAX_N], n, s, L, x[MAX_N], y[MAX_N], t[MAX_N], d[MAX_TEAM], ti[MAX_TEAM];
| ^
a.cc:9:5: note: 'int d [10000000]' previously declared here
9 | int d[MAX_N], n, s, L, x[MAX_N], y[MAX_N], t[MAX_N], d[MAX_TEAM], ti[MAX_TEAM];
| ^
|
s668354319 | p00277 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 1000000;
int Time[MAX];
int Team[MAX];
int takai[MAX];
int takai_n[MAX];
int Team_max[MAX];
int main(){
int N,R,L;
int d,t,x;
int temp,temp1=0,flag = 0;
cin >> N >> R >> L;
memset(takai,0,sizeof(takai+N)+1);
memset(takai_n,0,sizeof(takai_n+N)+1);
memset(takai,0,sizeof(takai+N)+1);
for(int i=1;i<=N;i++){
takai_n[i] = i;
}
for(int h=0;h<R;h++){
cin >> d >> t >> x;
for(int i=1;i<=N;i++){
if(d == takai_n[i] ) takai[i] += x;
}
for(int i=1;i<N;i++){
for(int j=i+1;j<N+1;j++){
if(takai[i] < takai[j]){
swap(takai[i],takai[j]);
swap(takai_n[i],takai_n[j]);
}
}
}
Time[t] = takai[1];
Team[t] = takai_n[1];
}
int n= 0;
for(int i=0;i<=L;i++){
if(Time[i] > 0 && flag == 0) {
temp = i;
temp1 = Team[i];
flag= 1;
}
else if(Time[i] > 0 && flag == 1){
Team_max[temp1] += i - temp;
cout << Team_max[temp1] << endl;
temp = i;
temp1 = Team[i];
}
if(Time[i] > 0) n =i;
if(i == L)Team_max[temp1] += L-n;
}
int a = 0;int te = 0;
for(int i=0;i<=N;i++){
if(a < Team_max[i]){
a = Team_max[i];
te = i;
}
}
cout << te << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'memset' was not declared in this scope
15 | memset(takai,0,sizeof(takai+N)+1);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s939783607 | p00277 | C++ | #include "MDebug.h"
#include <iostream>
#include <queue>
#include <cstring>
#include <algorithm>
#include <conio.h>
using namespace std;
static const int MAX_N = 1000001;
int T_Time[MAX_N], Score[MAX_N];
int main()
{
int N, R, L, d, t, x, most, P_T = 0, P_D = 1;
priority_queue< pair< int, int > > ScoreHeap;
memset( Score , 0, sizeof( Score ) );
memset( T_Time, 0, sizeof( T_Time ) );
cin >> N >> R >> L;
for( int i = 0; i < R; i++ ) {
cin >> d >> t >> x;
Score[d] += x;
ScoreHeap.push( make_pair( Score[d], -d ) );
while( true ) {
pair< int, int > temp = ScoreHeap.top();
if( temp.first == Score[-temp.second] ) {
T_Time[P_D] += t - P_T;
P_D = -temp.second;
P_T = t;
break;
}
ScoreHeap.pop();
}
}
T_Time[P_D] += L - P_T;
for( int i = 1; i <= N - 1; i++ ) {
if( T_Time[i] == T_Time[i + 1] ) most = i;
else if( T_Time[i] < T_Time[i + 1] ) most = i + 1;
else most = i;
}
cout << most << endl;
return 0;
} | a.cc:1:10: fatal error: MDebug.h: No such file or directory
1 | #include "MDebug.h"
| ^~~~~~~~~~
compilation terminated.
|
s564026815 | p00277 | C++ | #include<stdio.h>
int main(){
int a,toread,N,R,L,d,t,x,i,time=0,team,T[1001],P[1001],i2,max,dscanf[1001],tscanf[1001],xscanf[1001];
scanf("%d%d%d",&N,&R,&L);
for(i=0;i<=R;i++){
T[i]=0;
P[i]=0;
}
for(i=1;i<=R;i++){
scanf("%d%d%d",&d,&t,&x);
dscanf[i]=d;
tscanf[i]=t;
xscanf[i]=x;
}
for(i=1;i<=R;i++){
if(i!=1){
for(a=i;a>=1;a--){
if(tscanf[i]>=tscanf[a]){
toread=tscanf[i];
tscanf[i]=tscanf[a];
tscanf[a]=toread;
toread=dscanf[i];
dscanf[i]=dscanf[a];
dscanf[a]=toread;
toread=xscanf[i];
xscanf[i]=xscanf[a];
xscanf[a]=toread;
}
}
}
}
for(i=1;i<=R;i++){
d=dscanf[i];
t=tscanf[i];
x=xscanf[i];
P[d]+=x;
max=0;
if(i!=1){
for(i2=1;i2<=R;i2++){
if(P[i2]>P[max]){
max=i2;
}
else if(P[i2]==P[max]&&i2<max){
max=i2;
}
}
T[team]+=t-time;
}
time=t;
team=max;
T[0]=0;
}
if(time!=L){
T[max]=L-time;
}
for(i=1;i<=R;i++){
if(T[i]>T[max]){
max=i;
}
else if(T[i]==T[max]&&i<max){
max=i;
}
}
printf("%d\n",max);
return 0;
}#include<stdio.h>
int main(){
int a,toread,N,R,L,d,t,x,i,time=0,team,T[1001],P[1001],i2,max,dscanf[1001],tscanf[1001],xscanf[1001];
scanf("%d%d%d",&N,&R,&L);
for(i=0;i<=R;i++){
T[i]=0;
P[i]=0;
}
for(i=1;i<=R;i++){
scanf("%d%d%d",&d,&t,&x);
dscanf[i]=d;
tscanf[i]=t;
xscanf[i]=x;
}
for(i=1;i<=R;i++){
if(i!=1){
for(a=i;a>=1;a--){
if(tscanf[i]>=tscanf[a]){
toread=tscanf[i];
tscanf[i]=tscanf[a];
tscanf[a]=toread;
toread=dscanf[i];
dscanf[i]=dscanf[a];
dscanf[a]=toread;
toread=xscanf[i];
xscanf[i]=xscanf[a];
xscanf[a]=toread;
}
}
}
}
for(i=1;i<=R;i++){
d=dscanf[i];
t=tscanf[i];
x=xscanf[i];
P[d]+=x;
max=0;
if(i!=1){
for(i2=1;i2<=R;i2++){
if(P[i2]>P[max]){
max=i2;
}
else if(P[i2]==P[max]&&i2<max){
max=i2;
}
}
T[team]+=t-time;
}
time=t;
team=max;
T[0]=0;
}
if(time!=L){
T[max]=L-time;
}
for(i=1;i<=R;i++){
if(T[i]>T[max]){
max=i;
}
else if(T[i]==T[max]&&i<max){
max=i;
}
}
printf("%d\n",max);
return 0;
} | a.cc:66:2: error: stray '#' in program
66 | }#include<stdio.h>
| ^
a.cc:66:3: error: 'include' does not name a type
66 | }#include<stdio.h>
| ^~~~~~~
|
s891183620 | p00277 | C++ | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* 0282 Programming Contest
*/
public class Main {
public static void main(String[] args) throws IOException {
// Read contest basic info
Contest contest = readContest();
// Read record and count up time
contest.start();
// Show result
System.out.println(contest.getWinner());
}
// Read contest basic info
private static Contest readContest() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String[] splitted = reader.readLine().split(" ");
int[] converted = convertStringToInt(splitted);
return new Contest(converted[0], converted[1], converted[2], reader);
}
// Convert string array to int array
private static int[] convertStringToInt(String[] str) {
int[] converted = new int[str.length];
for (int i = 0; i < str.length; i++) {
converted[i] = Integer.parseInt(str[i]);
}
return converted;
}
// Get max score team
private static int getMaxScoreTeam(long[] target) {
int index = 1;
long max = target[1];
for (int i = 2; i < target.length; i++) {
if (max < target[i]) {
max = target[i];
index = i;
}
}
return index;
}
// Get max show time team
private static int getMaxShowTimeTeam(int[] target) {
int index = 1;
long max = target[1];
for (int i = 2; i < target.length; i++) {
if (max < target[i]) {
max = target[i];
index = i;
}
}
return index;
}
// Contest
private static class Contest {
private static final int TEAM_NO = 0;
private static final int TIME = 1;
private static final int SCORE = 2;
private int teamNo;
private int recordNo;
private int endTime;
private BufferedReader reader;
private int winner;
// Constructor
public Contest(int teamNo, int recordNo, int time, BufferedReader reader) {
this.teamNo = teamNo;
this.recordNo = recordNo;
this.endTime = time;
this.reader = reader;
}
// Start contest
public void start() throws IOException {
int timer = 0;
long[] teamScoreMap = new long[teamNo + 1];
int[] teamShowTimeMap = new int[teamNo + 1];
// FIXME: ???????????????????????????????????????????????§???????????§???????????????????????????
int previousMaxTeam = 1;
long previousMaxScore = 0;
for (int i = 0; i < recordNo; i++) {
int[] record = convertStringToInt(reader.readLine().split(" "));
// Reduce high cost process, for test case #7
if (record[TIME] != timer) {
// Select show team
// currentTeam = getMaxScoreTeam(teamScoreMap);
// Add show time
int showTime = record[TIME] - timer;
teamShowTimeMap[previousMaxTeam] += showTime;
// Update currentTime
timer = record[TIME];
}
// Update score
teamScoreMap[record[TEAM_NO]] += record[SCORE];
// Update max score
if (previousMaxScore < teamScoreMap[record[TEAM_NO]]) {
// If over, update max score and team
previousMaxTeam = record[TEAM_NO];
previousMaxScore = teamScoreMap[record[TEAM_NO]];
} else if(previousMaxTeam == record[TEAM_NO] && record[SCORE] < 0) {
// If max score is decreased, search max score again
previousMaxTeam = getMaxScoreTeam(teamScoreMap);
previousMaxScore = teamScoreMap[previousMaxTeam];
}
// Debug
/*
System.out.println("Record: " + i);
System.out.println("previousMaxScore: " + previousMaxScore + ", previousMaxTeam: " + previousMaxTeam);
System.out.print("teamScore: ");
Arrays.stream(teamScoreMap).forEach(score -> System.out.print(score + ", "));;
System.out.println();
System.out.print("teamShowTime: ");
Arrays.stream(teamShowTimeMap).forEach(t -> System.out.print(t + ", "));;
System.out.println();
System.out.println();
*/
}
// Finally add show time to end of contest
if (endTime != timer) {
// currentTeam = getMaxScoreTeam(teamScoreMap);
int showTime = endTime - timer;
teamShowTimeMap[previousMaxTeam] += showTime;
}
// Debug
/*
System.out.println("Finish.");
System.out.println("previousMaxScore: " + previousMaxScore + ", previousMaxTeam: " + previousMaxTeam);
System.out.print("teamScore: ");
Arrays.stream(teamScoreMap).forEach(score -> System.out.print(score + ", "));;
System.out.println();
System.out.print("teamShowTime: ");
Arrays.stream(teamShowTimeMap).forEach(t -> System.out.print(t + ", "));;
System.out.println();
System.out.println();
*/
// Decide winner
winner = getMaxShowTimeTeam(teamShowTimeMap);
}
// Get winner
public int getWinner() {
return winner;
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.BufferedReader;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.io.InputStreamReader;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
8 | public class Main {
| ^~~~~~
|
s548167235 | p00277 | C++ | #include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define INF LLONG_MAX/3
using namespace std;
P segment[500000];
int point[100000];
signed main(){
int a,b,c;
cin>>a>>b>>c;
int d=1;
while(d<a)d*=2;
for(int e=0;e<d;e++){
if(e<a)segment[d-1+e]=P(0,e);
else segment[d-1-e]=P(INF,INF);
}
d--;
for(int e=0;e<d;e++){
segment[e]=min(segment[e*2+1],segment[e*2+2]);
}
int last=0,team=0;
for(int i=0;i<b;i++){
int x,y,z;sacnf("%lld%lld%lld",&x,&y,&z);
x--;
int S=d+x;
segment[S].first-=z;
while(S>0){
S/=2;
segment[S]=min(segment[S*2+1],segment[S*2+2]);
}
point[team]+=y-last;
team=segment[0].second;
last=y;
}
point[team]+=c-last;
int n=-(INF),m=0;
for(int i=0;i<a;i++){if(point[i]>n){n=point[i];m=i+1;}}
cout<<m<<endl;
} | a.cc: In function 'int main()':
a.cc:24:19: error: 'sacnf' was not declared in this scope; did you mean 'scanf'?
24 | int x,y,z;sacnf("%lld%lld%lld",&x,&y,&z);
| ^~~~~
| scanf
|
s031953368 | p00277 | C++ | #include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)
struct Team{
int id;
int point;
int showed;
Team(int ia,int ib,int ic);
};
int H,team[MAX+1];
void swap(*a,*b){
tmp=*a;
*a=*b;
*b=tmp;
}
void maxHeapify(int i){
int l,r,largest;
l=2*i;
r=2*i+1;
if(l<=H&&team[l].point>team[i].point){
largest=l;
}
elsif(team[l].point==team[i].point){
if(team[l].id<team[i].id){
largest=l;
}
}
else largest=i;
if (r<=H&&team[r].point>team[largest].point){
largest=r;
}
elsif(team[r].point==team[largest].point){
if(team[r].id<team[largest]){
largest=r;
}
}
if(largest!=i){
swap(team[i],team[largest]);
maxHeapify(largest);
}
}
int extract(team){
int maxv;
if(H<1) return -INFTY;
maxv=team[1];
team[1]=team[H--];
maxHeapify(1);
return maxv;
}
void IncreaseKey(int i,int key){
team[i].point+=key;
while(i>1&&team[i/2]<team[i]){
swap(team[i],team[i/2]);
i=i/2;
}
}
void insert(int id){
H++;
team[H]=Team(id,0,0);
}
void show_top(team){
top=0;
for(int i=0;i<n;i++){
if(team[i].showed>team[top].showed) top=i;
}
printf("%d\n",top);
}
int main(){
int n,r,l;
int d[1000000];
int t[1000000];
int x[1000000];
scanf("%d%d%d",&n,&r,&l);
for(int i=0;i<n;i++){
insert(i);
}
for(int i=0;i<r;i++){
scanf("%d%d%d",&d[i],&t[i],&x[i]);
IncreaseKey(d[i],x[i]);
top=extract(team);
if(i>0){
top.showed+=t[i]-t[i-1];
}
}
show_top(team);
}
| a.cc:15:6: error: variable or field 'swap' declared void
15 | void swap(*a,*b){
| ^~~~
a.cc:15:12: error: 'a' was not declared in this scope
15 | void swap(*a,*b){
| ^
a.cc:15:15: error: 'b' was not declared in this scope
15 | void swap(*a,*b){
| ^
a.cc: In function 'void maxHeapify(int)':
a.cc:25:20: error: request for member 'point' in 'team[l]', which is of non-class type 'int'
25 | if(l<=H&&team[l].point>team[i].point){
| ^~~~~
a.cc:25:34: error: request for member 'point' in 'team[i]', which is of non-class type 'int'
25 | if(l<=H&&team[l].point>team[i].point){
| ^~~~~
a.cc:28:17: error: request for member 'point' in 'team[l]', which is of non-class type 'int'
28 | elsif(team[l].point==team[i].point){
| ^~~~~
a.cc:28:32: error: request for member 'point' in 'team[i]', which is of non-class type 'int'
28 | elsif(team[l].point==team[i].point){
| ^~~~~
a.cc:28:3: error: 'elsif' was not declared in this scope
28 | elsif(team[l].point==team[i].point){
| ^~~~~
a.cc:33:3: error: 'else' without a previous 'if'
33 | else largest=i;
| ^~~~
a.cc:34:21: error: request for member 'point' in 'team[r]', which is of non-class type 'int'
34 | if (r<=H&&team[r].point>team[largest].point){
| ^~~~~
a.cc:34:41: error: request for member 'point' in 'team[largest]', which is of non-class type 'int'
34 | if (r<=H&&team[r].point>team[largest].point){
| ^~~~~
a.cc:37:17: error: request for member 'point' in 'team[r]', which is of non-class type 'int'
37 | elsif(team[r].point==team[largest].point){
| ^~~~~
a.cc:37:38: error: request for member 'point' in 'team[largest]', which is of non-class type 'int'
37 | elsif(team[r].point==team[largest].point){
| ^~~~~
a.cc: At global scope:
a.cc:47:13: error: invalid conversion from 'int*' to 'int' [-fpermissive]
47 | int extract(team){
| ^~~~
| |
| int*
a.cc:47:18: error: expected ',' or ';' before '{' token
47 | int extract(team){
| ^
a.cc: In function 'void IncreaseKey(int, int)':
a.cc:56:11: error: request for member 'point' in 'team[i]', which is of non-class type 'int'
56 | team[i].point+=key;
| ^~~~~
a.cc: In function 'void insert(int)':
a.cc:64:11: error: cannot convert 'Team' to 'int' in assignment
64 | team[H]=Team(id,0,0);
| ^~~~~~~~~~~~
| |
| Team
a.cc: At global scope:
a.cc:66:6: error: variable or field 'show_top' declared void
66 | void show_top(team){
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:86:5: error: 'top' was not declared in this scope
86 | top=extract(team);
| ^~~
a.cc:86:16: error: 'extract' cannot be used as a function
86 | top=extract(team);
| ~~~~~~~^~~~~~
a.cc:91:3: error: 'show_top' was not declared in this scope
91 | show_top(team);
| ^~~~~~~~
|
s050896597 | p00277 | C++ | #include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
struct Team{
int id;
int point;
int showed;
};
int H=0;
void swap(int *a,int *b){
int tmp;
tmp=*a;
*a=*b;
*b=tmp;
}
void maxHeapify(int i,Team* team){
int l,r,largest;
l=2*i;
r=2*i+1;
if(l<=H&&team[l].point>team[i].point){
largest=l;
}
else if(team[l].point==team[i].point){
if(team[l].id<team[i].id){
largest=l;
}
}
else largest=i;
if (r<=H&&team[r].point>team[largest].point){
largest=r;
}
else if(team[r].point==team[largest].point){
if(team[r].id<team[largest].id){
largest=r;
}
}
if(largest!=i){
swap(team[i],team[largest]);
maxHeapify(largest,team);
}
}
int search(int id,int n,Team* team){
for(int i=1;i<=n;i++){
if(team[i].id==id){
return i;
}
}
}
void IncreaseKey(int id,int key,int n,Team* team){
int t=search(id,n);
team[t].point+=key;
if(key<0){
maxHeapify(search(id,n,team));
}
else{
while(t>1&&team[t/2].point<team[t].point){
swap(team[t],team[t/2]);
t=t/2;
}
}
}
void insert(int id,Team* team){
H++;
team[H].id=id;
team[H].point=0;
team[H].showed=0;
}
void show_top(Team* team,int n){
int top=1;
int top_id=team[top].id;
for(int i=1;i<=n;i++){
if(team[i].showed>team[top].showed) top_id=team[i].id,top=i;
else if(team[i].showed==team[top].showed){
if(team[i].id<team[top].id){
top_id=team[i].id,top=i;
}
}
}
printf("%d\n",top_id);
}
int main(){
int n,r,l;
scanf("%d%d%d",&n,&r,&l);
Team team[n];
int d[r];
int t[r];
int x[r];
for(int i=1;i<=n;i++){
insert(i);
}
for(int i=0;i<r;i++){
scanf("%d%d%d",&d[i],&t[i],&x[i]);
}
for(int i=0;i<r;i++){
if(i==0){
team[search(1,n)].showed+=t[0];
}
IncreaseKey(d[i],x[i],n);
if(i<r-1){
team[1].showed+=t[i+1]-t[i];
}
else{
team[1].showed+=l-t[r-1];
}
}
return 0;
}
| a.cc: In function 'void IncreaseKey(int, int, int, Team*)':
a.cc:52:15: error: no matching function for call to 'search(int&, int&)'
52 | int t=search(id,n);
| ~~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate: 'template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> _ForwardIterator1 std::search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
2332 | search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
| ^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate expects 5 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate: 'template<class _FIter1, class _FIter2> _FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2)'
4090 | search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate: 'template<class _ForwardIterator, class _Searcher> _ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&)'
4184 | search(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
112 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate expects 6 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
117 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate expects 5 arguments, 2 provided
a.cc:44:5: note: candidate: 'int search(int, int, Team*)'
44 | int search(int id,int n,Team* team){
| ^~~~~~
a.cc:44:5: note: candidate expects 3 arguments, 2 provided
a.cc:55:15: error: too few arguments to function 'void maxHeapify(int, Team*)'
55 | maxHeapify(search(id,n,team));
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:17:6: note: declared here
17 | void maxHeapify(int i,Team* team){
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:92:11: error: too few arguments to function 'void insert(int, Team*)'
92 | insert(i);
| ~~~~~~^~~
a.cc:64:6: note: declared here
64 | void insert(int id,Team* team){
| ^~~~~~
a.cc:99:18: error: no matching function for call to 'search(int, int&)'
99 | team[search(1,n)].showed+=t[0];
| ~~~~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate: 'template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> _ForwardIterator1 std::search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
2332 | search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
| ^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate expects 5 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate: 'template<class _FIter1, class _FIter2> _FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2)'
4090 | search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate: 'template<class _ForwardIterator, class _Searcher> _ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&)'
4184 | search(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
112 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate expects 6 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
117 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate expects 5 arguments, 2 provided
a.cc:44:5: note: candidate: 'int search(int, int, Team*)'
44 | int search(int id,int n,Team* team){
| ^~~~~~
a.cc:44:5: note: candidate expects 3 arguments, 2 provided
a.cc:101:16: error: too few arguments to function 'void IncreaseKey(int, int, int, Team*)'
101 | IncreaseKey(d[i],x[i],n);
| ~~~~~~~~~~~^~~~~~~~~~~~~
a.cc:51:6: note: declared here
51 | void IncreaseKey(int id,int key,int n,Team* team){
| ^~~~~~~~~~~
a.cc: In function 'int search(int, int, Team*)':
a.cc:50:1: warning: control reaches end of non-void function [-Wreturn-type]
50 | }
| ^
|
s272069047 | p00277 | C++ | #include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
const int MAX_N = 1 << 17;
typedef pair<int, int> P;
int n, cnt[MAX_N];
P dat[2*MAX_N-1];
void init(int n_){
n = 1;
while(n < n_) n *= 2;
for(int i=0;i<2*n-1;i++) dat[i] = make_pair(INT_MAX, INT_MAX);
}
void update(int k, P a){
k += n - 1;
dat[k] = a;
while(k > 0){
k = (k - 1) / 2;
dat[k] = min(dat[k*2+1], dat[k*2+2]);
}
}
//min [a, b)
//call query(a, b, 0, 0, n)
P query(int a, int b, int k, int l, int r){
if(r <= a || b <= l) return make_pair(INT_MAX, INT_MAX);
if(a <= l && r <= b) return dat[k];
else{
P vl = query(a, b, k*2+1, l, (l+r)/2);
P vr = query(a, b, k*2+2, (l+r)/2, r);
return min(vl, vr);
}
}
int main(){
int N, R, L;
cin >> N >> R >> L;
memset(cnt, 0, sizeof(cnt));
init(N);
for(int i=0;i<N;i++) update(i, make_pair(0, i));
int T = 0;
for(int i=0;i<R;i++){
int d, t, x;
cin >> d >> t >> x;
d--;
if(T != t){
P tmp = query(0, N, 0, 0, n);
cnt[tmp.second] += t - T;
}
P tmp = query(d, d + 1, 0, 0, n);
update(d, make_pair(tmp.first - x, tmp.second));
T = t;
}
if(T != L){
P tmp = query(0, N, 0, 0, n);
cnt[tmp.second] += L - T;
}
int valM = -1, id;
for(int i=0;i<N;i++){
if(valM < cnt[i]){
valM = cnt[i];
id = i;
}
}
cout << id + 1 << endl;
} | a.cc: In function 'void init(int)':
a.cc:18:47: error: 'INT_MAX' was not declared in this scope
18 | for(int i=0;i<2*n-1;i++) dat[i] = make_pair(INT_MAX, INT_MAX);
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <map>
+++ |+#include <climits>
5 |
a.cc: In function 'P query(int, int, int, int, int)':
a.cc:33:41: error: 'INT_MAX' was not declared in this scope
33 | if(r <= a || b <= l) return make_pair(INT_MAX, INT_MAX);
| ^~~~~~~
a.cc:33:41: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
|
s291651783 | p00277 | C++ | #include<iostream>
using namespace std;
int top_id(int *x,int N){
int top=x[1];
int id=1;
for(int i=2;i<=N;i++){
if(top<x[i]){
top = x[i];
id = i;
}
}
return id;
}
int main(){
int N,R,L;
cin >> N >> R >> L;
int top=1;
int d,t[2],x;
int tim[N+1];
int total[N+1];
t[0] = 0;
for(int i=0;i<N;i++){
tim[i] = 0;
total[i] = 0;
}
for(int i=0;i<R;i++){
cin >> d >> t[1] >> x;
total[d] += x;
tim[top] += (t[1] - t[0]);
top = top_id(total,N);
t[0] = t[1];
}
tim[top] += (L - t[0]);
int top_t=0;
int ans;
for(int i=1;i<=N;i++){
if(top_t<x[i]){
top_t = x[i];
ans = i;
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:37:15: error: invalid types 'int[int]' for array subscript
37 | if(top_t<x[i]){
| ^
a.cc:38:16: error: invalid types 'int[int]' for array subscript
38 | top_t = x[i];
| ^
|
s225309513 | p00277 | C++ | #include<iostream>
using namespace std;
int top_id(int *x,int N){
int top=x[1];
int id=1;
for(int i=2;i<=N;i++){
if(top<x[i]){
top = x[i];
id = i;
}
}
return id;
}
int main(){
int N,R,L;
cin >> N >> R >> L;
int top=1;
int d,t,x;
int oldt=0;
int tim[N+1];
int total[N+1];
t[0] = 0;
for(int i=0;i<=N;i++){
tim[i] = 0;
total[i] = 0;
}
for(int i=0;i<R;i++){
cin >> d >> t >> x;
tim[top] += (t - oldt);
oldt = t;
total[d] += x;
top = top_id(total,N)
}
tim[top] += (L - t[0]);
int top_t=0;
int ans;
for(int i=1;i<=N;i++){
if(top_t<tim[i]){
top_t = tim[i];
ans = i;
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:4: error: invalid types 'int[int]' for array subscript
22 | t[0] = 0;
| ^
a.cc:32:26: error: expected ';' before '}' token
32 | top = top_id(total,N)
| ^
| ;
33 | }
| ~
a.cc:34:21: error: invalid types 'int[int]' for array subscript
34 | tim[top] += (L - t[0]);
| ^
|
s381882769 | p00277 | C++ | #include <cstdio>
#include <utility>
#include <queue>
#include <algorithm>
using namespace std;
int main(){
typedef pair<int,int> pii;
priority_queue<pii> pq;
int n, r, l, d, t, x, u = 0;
scanf("%d%d%d", &n, &r, &l);
vector<int> s(n + 1), c(n + 1);
for(int i = 1; i <= n; ++i){
pq.push(pii(0, ~i));
}
for(int i = 0; ; ++i){
if(i == r){
t = l;
}
else{
scanf("%d%d%d", &d, &t, &x);
}
while(1){
pii &p = pq.top();
if(s[~p.second] == p.first){
c[~p.second] += t - u;
break;
}
pq.pop();
}
if(i == r){
break;
}
s[d] += x;
pq.push(pii(s[d], ~d));
u = t;
}
int ans = max_element(c.begin(), c.end()) - c.begin();
printf("%d\n", ans);
} | a.cc: In function 'int main()':
a.cc:24:40: error: binding reference of type 'pii&' {aka 'std::pair<int, int>&'} to 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'const std::pair<int, int>'} discards qualifiers
24 | pii &p = pq.top();
| ~~~~~~^~
|
s539123053 | p00277 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>
using namespace std;
typedef long long LL;
typedef pair<LL, int> P;
const LL INF = LONG_MAX / 2LL;
const int MAX_N = 262144;
P dat[MAX_N * 2 - 1];
LL times[MAX_N];
int n, r, l;
void init()
{
for (int i = 0; i < 2 * n - 1; i++)
{
dat[i] = P(0, -(2 << 20));
}
for (int i = 0; i < n; i++)
{
dat[n + i - 1].second = -i;
}
}
void update(int i, LL x)
{
i += n - 1;
dat[i].first += x;
while (i > 0)
{
i = (i - 1) / 2;
dat[i] = max(dat[i * 2 + 1], dat[i * 2 + 2]);
}
}
P query(int a, int b, int k, int l, int r)
{
if(r <= a || b <= l) return P(-INF, -1);
if(a <= l && r <= b) return dat[k];
else
{
P vl = query(a, b,k * 2 + 1, l, (l + r) / 2);
P vr = query(a, b,k * 2 + 1, (l + r) / 2, r);
if(vr > vl) return vr;
return vl;
}
}
int main(void)
{
while(cin >> n >> r >> l && n >= 2)
{
vector<int> d(r), x(r), t(r);
for (int i = 0; i < r; i++)
{
cin >> d[i] >> x[i] >> t[i];
d[i]--;
}
init();
memset(times, 0, sizeof(times));
P pre = P(0,0);
int pret = 0;
for (int i = 0; i < r; i++)
{
if(i + 1 < r && t[i] == t[i + 1])
{
i++;
update(d[i], x[i]);
continue;
}
update(d[i], x[i]);
P p = query(0, n-1, 0, 0, n);
times[-pre.second] += (t[i] - pret);
pret = t[i];
pre = p;
}
cout << (max_element(times, times + n) - times) + 1 << endl;
}
return 0;
} | a.cc:17:16: error: 'LONG_MAX' was not declared in this scope
17 | const LL INF = LONG_MAX / 2LL;
| ^~~~~~~~
a.cc:12:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
11 | #include <queue>
+++ |+#include <climits>
12 |
|
s088838446 | p00277 | C++ |
//AOJ0099とほぼ同じ。座標圧縮がいらない。
//1位の見つけ方→1位が得点(順位そのまま),1位以外が得点(1位と得点したチームを比べる),1位以外が減点(順位そのまま),1位が減点(O(N)で1位を探す)
//欠点:最悪計算量O(N^2)
#include<iostream>
#define rep(j,n) for(j = 0;j < n;j++)
using namespace std;
int N,R,L; //チーム数 <= 10^5,レコード数 <= 10^6,競技時間
int n[1000000],t[1000000],x[1000000];
int score[100000];
int time[100000];
int main(){
int i,j;
int num = 0; //今最高得点の奴の番号
cin >> N >> R >> L;
rep(i,R){
cin >> n[i] >> t[i] >> x[i];
n[i]--;
}
time[0] = t[0];
rep(i,R){
//cout << "num = " << num << endl;
score[ n[i] ] += x[i];
//1位がそのまま
if( (n[i] == num && x[i] >= 0) || (n[i] != num && x[i] <= 0) ){
if(i < R-1)
time[ num ] += t[i+1] - t[i];
else
time[ num ] += L - t[i];
continue;
}
//1位と今のチームを比べる
if( n[i] != num && x[i] >= 0 ){
if( ( score[ num ] > score[ n[i] ] ) || ( score[ num ] == score[ n[i] ] && num < n[i] ) ){
}
else{
num = n[i];
}
if(i < R-1)
time[ num ] += t[i+1] - t[i];
else
time[ num ] += L - t[i];
continue;
}
//1位を調べなおす
for( j = 0; j < N; j++){
if( ( score[ num ] > score[ j ] ) || ( score[ num ] == score[ j ] && num < j ) ){
}
else{
num = j;
}
}
if(i < R-1)
time[ num ] += t[i+1] - t[i];
else
time[ num ] += L - t[i];
}
int MAX = 0,ANS = 0;
for(j = 0;j < N;j++){
if(MAX < time[j]){
MAX = time[j];
ANS = j;
}
}
ANS++;
cout << ANS << endl;
return 0;
} | a.cc:13:16: error: 'int time [100000]' redeclared as different kind of entity
13 | int time[100000];
| ^
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:5:
/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:23:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[0] = t[0];
| ^
a.cc:23:17: error: assignment of read-only location '* time'
23 | time[0] = t[0];
| ~~~~~~~~^~~~~~
a.cc:31:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[ num ] += t[i+1] - t[i];
| ^
a.cc:31:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[ num ] += t[i+1] - t[i];
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
a.cc:31:45: error: assignment of read-only location '*(time + ((sizetype)num))'
a.cc:33:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
33 | time[ num ] += L - t[i];
| ^
a.cc:33:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
33 | time[ num ] += L - t[i];
| ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:33:45: error: assignment of read-only location '*(time + ((sizetype)num))'
a.cc:44:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | time[ num ] += t[i+1] - t[i];
| ^
a.cc:44:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | time[ num ] += t[i+1] - t[i];
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
a.cc:44:45: error: assignment of read-only location '*(time + ((sizetype)num))'
a.cc:46:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[ num ] += L - t[i];
| ^
a.cc:46:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[ num ] += L - t[i];
| ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:46:45: error: assignment of read-only location '*(time + ((sizetype)num))'
a.cc:58:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | time[ num ] += t[i+1] - t[i];
| ^
a.cc:58:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | time[ num ] += t[i+1] - t[i];
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
a.cc:58:37: error: assignment of read-only location '*(time + ((sizetype)num))'
a.cc:60:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[ num ] += L - t[i];
| ^
a.cc:60:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[ num ] += L - t[i];
| ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:60:37: error: assignment of read-only location '*(time + ((sizetype)num))'
a.cc:64:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
64 | if(MAX < time[j]){
| ^
a.cc:64:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
64 | if(MAX < time[j]){
| ~~~~^~~~~~~~~
a.cc:65:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
65 | MAX = time[j];
| ^
a.cc:65:37: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
65 | MAX = time[j];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s317062974 | p00277 | C++ | #include <cstdio>
int P[100000],T[100000];
int main() {
int N,R,L,PT=0,n1=0;
scanf("%d %d %d",&N,&R,&L);
for(int i=0;i<R;i++) {
int d,t,x;
scanf("%d %d %d",&d,&t,&x); d--;
P[d]+=x;
if(x>0) {
if(P[d]>p1||(P[d]==P[n1]&&n1>d)) {
T[n1]+=t-PT+1;
PT=t;
n1=d;
}
}
if(x<0) {
if(d!=n1) continue;
int n2=n1,p2=P[d];
for(int j=N-1;j>=0;j--) {
if(p2<=P[j]) {n2=j,p2=P[j];}
}
if(n2!=n1) {
T[n1]+=t-PT+1;
PT=t;
n1=n2;
}
}
}
T[n1]+=L-PT+1;
int ans_n=0,ans_t=0;
for(int i=0;i<N;i++) {
if(ans_t<T[i]) {
ans_t=T[i];
ans_n=i;
}
}
printf("%d\n",ans_n+1);
} | a.cc: In function 'int main()':
a.cc:11:21: error: 'p1' was not declared in this scope; did you mean 'n1'?
11 | if(P[d]>p1||(P[d]==P[n1]&&n1>d)) {
| ^~
| n1
|
s275464608 | p00277 | C++ | #include<iostream>
#include<math.h>
using namespace std ;
int num[2][262144] = {} ; // 0 point , 1 num
int ranking[100001] = {} ;
int n , r , l ;
int d , t , x ;
int minus = -1001 ;
int btd , bt , sum1=-1 , sum2=0 ;
void count( int p ){
if( num[0][p*2] >= num[0][p*2+1] ){
num[0][p] = num[0][p*2] ;
num[1][p] = num[1][p*2] ;
}else {
num[0][p] = num[0][p*2+1] ;
num[1][p] = num[1][p*2+1] ;
}
if( p!=1 ) count( p/2 ) ;
}
int main(){
cin >> n >> r >> l ;
for( int i=1 ; i<=n ; i++ ){
num[1][i+131071] = i ;
}
for( int i=0 ; i<r ; i++ ){
cin >> d >> t >> x ;
if( i==0 ) ranking[1] = t ;
num[0][d+131071] += x ;
if( minus < t ) minus = t ;
if( minus < 0 && t < 0 ){
count( 131072 / 2 ) ;
}else count( ( d+131071 ) / 2 ) ;
if( i != 0 ) ranking[btd] = t-bt ;
bt = t ;
btd = num[1][1] ;
}
ranking[btd] = l-bt ;
for( int i=1 ; i<=n ; i++ ){
if( sum1 < ranking[i] ){
sum1 = ranking[i] ;
sum2 = i ;
}
}
cout << sum2 << endl ;
return 0;
} | a.cc: In function 'int main()':
a.cc:38:21: error: reference to 'minus' is ambiguous
38 | if( minus < t ) minus = t ;
| ^~~~~
In file included from /usr/include/c++/14/string:49,
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_function.h:163:12: note: candidates are: 'template<class _Tp> struct std::minus'
163 | struct minus;
| ^~~~~
a.cc:9:5: note: 'int minus'
9 | int minus = -1001 ;
| ^~~~~
a.cc:38:33: error: reference to 'minus' is ambiguous
38 | if( minus < t ) minus = t ;
| ^~~~~
/usr/include/c++/14/bits/stl_function.h:163:12: note: candidates are: 'template<class _Tp> struct std::minus'
163 | struct minus;
| ^~~~~
a.cc:9:5: note: 'int minus'
9 | int minus = -1001 ;
| ^~~~~
a.cc:39:21: error: reference to 'minus' is ambiguous
39 | if( minus < 0 && t < 0 ){
| ^~~~~
/usr/include/c++/14/bits/stl_function.h:163:12: note: candidates are: 'template<class _Tp> struct std::minus'
163 | struct minus;
| ^~~~~
a.cc:9:5: note: 'int minus'
9 | int minus = -1001 ;
| ^~~~~
|
s414068538 | p00278 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
typedef map<int,int> mapi;
typedef pair<int,int> pr;
vector<pr> data;
vector<int> leader;
int n,q;
int study(int lo,int hi,int needs){
int f=lo,s=hi;
while(f<=s){
int mid=(f+s)/2;
if(data[mid].first>=needs)
s=mid-1;
else
f=mid+1;
}
return s-lo+1;
}
bool can(int space,int score){
int sum=0;
sum+=study(0,leader[0]-1,data[leader[0]].first-score);
for(int i=1;i<leader.size();i++){
int f=leader[i-1]+1,s=leader[i]-1;
sum+=study(f,s,data[leader[i]].first-score);
}
sum+=n-(leader[leader.size()-1]+1);
return space>=sum;
}
int search(int space){
int f=0,s=pow(10,9);
while(f<=s){
int mid=(f+s)/2;
if(can(space,mid))
s=mid-1;
else
f=mid+1;
}
return f;
}
int main() {
// your code goes here
int tmp;
string tmps;
while(cin >>n >> q && n!=0){
mapi point;
for(int i=0;i<n;i++){
cin >> tmp;
//point.insert(mapi::value_type(i+1,tmp));
data.push_back(pr(tmp,i+1));
}
sort(data.begin(),data.end());
for(int i=0;i<n;i++)
point.insert(mapi::value_type(data[i].second,i));
for(int j=0;j<q;j++){
cin >> tmps >> tmp;
if(tmps=="ADD")
leader.push_back(point[tmp]);
if(tmps=="REMOVE"){
for(vector<int>::iterator it=leader.begin()++;it!=leader.end();++it)
if(*it==point[tmp]){
it=leader.erase(it);
break;
}
}
if(tmps=="CHECK"){
int ans=search(tmp);
if(ans==1000000001)
cout << "NA" << endl;
else
cout << ans << endl;
}
else
sort(leader.begin(),leader.end());
}
data.clear();
leader.clear();
}
return 0;
} | a.cc: In function 'int study(int, int, int)':
a.cc:16:12: error: reference to 'data' is ambiguous
16 | if(data[mid].first>=needs)
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:12: note: 'std::vector<std::pair<int, int> > data'
9 | vector<pr> data;
| ^~~~
a.cc: In function 'bool can(int, int)':
a.cc:25:34: error: reference to 'data' is ambiguous
25 | sum+=study(0,leader[0]-1,data[leader[0]].first-score);
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:12: note: 'std::vector<std::pair<int, int> > data'
9 | vector<pr> data;
| ^~~~
a.cc:28:24: error: reference to 'data' is ambiguous
28 | sum+=study(f,s,data[leader[i]].first-score);
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:12: note: 'std::vector<std::pair<int, int> > data'
9 | vector<pr> data;
| ^~~~
a.cc: In function 'int search(int)':
a.cc:35:19: error: 'pow' was not declared in this scope
35 | int f=0,s=pow(10,9);
| ^~~
a.cc: In function 'int main()':
a.cc:54:25: error: reference to 'data' is ambiguous
54 | data.push_back(pr(tmp,i+1));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:12: note: 'std::vector<std::pair<int, int> > data'
9 | vector<pr> data;
| ^~~~
a.cc:56:22: error: reference to 'data' is ambiguous
56 | sort(data.begin(),data.end());
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:12: note: 'std::vector<std::pair<int, int> > data'
9 | vector<pr> data;
| ^~~~
a.cc:56:35: error: reference to 'data' is ambiguous
56 | sort(data.begin(),data.end());
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:12: note: 'std::vector<std::pair<int, int> > data'
9 | vector<pr> data;
| ^~~~
a.cc:58:54: error: expected primary-expression before '(' token
58 | point.insert(mapi::value_type(data[i].second,i));
| ^
a.cc:58:55: error: reference to 'data' is ambiguous
58 | point.insert(mapi::value_type(data[i].second,i));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:12: note: 'std::vector<std::pair<int, int> > data'
9 | vector<pr> data;
| ^~~~
a.cc:82:17: error: reference to 'data' is ambiguous
82 | data.clear();
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> co |
s311379367 | p00278 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef map<int,int> mapi;
typedef pair<int,int> pr;
vector<pr> data;
vector<int> leader;
int n,q;
int study(int lo,int hi,int needs){
int f=lo,s=hi;
while(f<=s){
int mid=(f+s)/2;
if(data[mid].first>=needs)
s=mid-1;
else
f=mid+1;
}
return s-lo+1;
}
bool can(int space,int score){
int sum=0;
sum+=study(0,leader[0]-1,data[leader[0]].first-score);
for(int i=1;i<leader.size();i++){
int f=leader[i-1]+1,s=leader[i]-1;
sum+=study(f,s,data[leader[i]].first-score);
}
sum+=n-(leader[leader.size()-1]+1);
return space>=sum;
}
int search(int space){
int f=0,s=pow(10,9);
while(f<=s){
int mid=(f+s)/2;
if(can(space,mid))
s=mid-1;
else
f=mid+1;
}
return f;
}
int main() {
// your code goes here
int tmp;
string tmps;
while(cin >>n >> q && n!=0){
mapi point;
for(int i=0;i<n;i++){
cin >> tmp;
//point.insert(mapi::value_type(i+1,tmp));
data.push_back(pr(tmp,i+1));
}
sort(data.begin(),data.end());
for(int i=0;i<n;i++)
point.insert(mapi::value_type(data[i].second,i));
for(int j=0;j<q;j++){
cin >> tmps >> tmp;
if(tmps=="ADD")
leader.push_back(point[tmp]);
if(tmps=="REMOVE"){
for(vector<int>::iterator it=leader.begin()++;it!=leader.end();++it)
if(*it==point[tmp]){
it=leader.erase(it);
break;
}
}
if(tmps=="CHECK"){
if(leader.size()==0)
ans=1000000001;
else
int ans=search(tmp);
if(ans==1000000001)
cout << "NA" << endl;
else
cout << ans << endl;
}
else
sort(leader.begin(),leader.end());
}
data.clear();
leader.clear();
}
return 0;
} | a.cc: In function 'int study(int, int, int)':
a.cc:17:12: error: reference to 'data' is ambiguous
17 | if(data[mid].first>=needs)
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:10:12: note: 'std::vector<std::pair<int, int> > data'
10 | vector<pr> data;
| ^~~~
a.cc: In function 'bool can(int, int)':
a.cc:26:34: error: reference to 'data' is ambiguous
26 | sum+=study(0,leader[0]-1,data[leader[0]].first-score);
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:10:12: note: 'std::vector<std::pair<int, int> > data'
10 | vector<pr> data;
| ^~~~
a.cc:29:24: error: reference to 'data' is ambiguous
29 | sum+=study(f,s,data[leader[i]].first-score);
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:10:12: note: 'std::vector<std::pair<int, int> > data'
10 | vector<pr> data;
| ^~~~
a.cc: In function 'int main()':
a.cc:55:25: error: reference to 'data' is ambiguous
55 | data.push_back(pr(tmp,i+1));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:10:12: note: 'std::vector<std::pair<int, int> > data'
10 | vector<pr> data;
| ^~~~
a.cc:57:22: error: reference to 'data' is ambiguous
57 | sort(data.begin(),data.end());
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:10:12: note: 'std::vector<std::pair<int, int> > data'
10 | vector<pr> data;
| ^~~~
a.cc:57:35: error: reference to 'data' is ambiguous
57 | sort(data.begin(),data.end());
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:10:12: note: 'std::vector<std::pair<int, int> > data'
10 | vector<pr> data;
| ^~~~
a.cc:59:54: error: expected primary-expression before '(' token
59 | point.insert(mapi::value_type(data[i].second,i));
| ^
a.cc:59:55: error: reference to 'data' is ambiguous
59 | point.insert(mapi::value_type(data[i].second,i));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:10:12: note: 'std::vector<std::pair<int, int> > data'
10 | vector<pr> data;
| ^~~~
a.cc:74:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
74 | ans=1000000001;
| ^~~
| abs
a.cc:77:36: error: 'ans' was not declared in this scope; did you mean 'abs'?
77 | if(ans==1000000001)
| ^~~
| abs
a.cc:86:17: error: reference to 'data' is ambiguous
86 | data.clear();
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: |
s078003509 | p00278 | C++ | #include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define MAX_N 1000000
int N;
int input[MAX_N + 1], s[MAX_N + 1];
vector<int> score;
bool C(int r, int x){
int inc = 0;
vector<int>::iterator it = score.begin();
for(int i = 1; i <= N; i++){
//p = 0;
while(it != score.end()){
if(*it < s[i]) it++;
else{
if(*it - s[i] <= r){
inc++;
break;
}
else break;
}
}
}
return N - inc <= x;
}
int main(){
int Q, a;
bool change;
char str[10];
scanf("%d%d", &N, &Q);
for(int i = 1; i <= N; i++){
scanf("%d", &input[i]);
s[i] = input[i];
}
sort(s + 1, s + N + 1);
for(int i = 0; i < Q; i++){
scanf("%s%d", str, &a);
if(strcmp(str, "ADD") == 0){
score.push_back(input[a]);
}
else if(strcmp(str, "REMOVE") == 0){
vector<int>::iterator it = score.begin();
for(; *it != input[a] && it != score.end(); it++);
score.erase(it);
}
else if(strcmp(str, "CHECK") == 0){
if(a == N){
printf("0\n");
continue;
}
if(score.empty()){
printf("NA\n");
continue;
}
sort(score.begin(), score.end());
/*
rの値を大きくしていくほど仲間はずれになる生徒の人数は
少なくなっていくので、二分探索が適用できる
*/
int lb = -1, rb = score[score.size() - 1];
change = false;
while(rb - lb > 1){
int mid = (lb + rb + 1) / 2;
if(C(mid, a)){
change = true;
rb = mid;
}
else lb = mid;
}
if(change) printf("%ld\n", rb);
else printf("NA\n");
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:20: error: 'strcmp' was not declared in this scope
46 | if(strcmp(str, "ADD") == 0){
| ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <vector>
+++ |+#include <cstring>
5 | using namespace std;
|
s753863616 | p00278 | C++ | #include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define MAX_N 1000000
int N;
int input[MAX_N + 1], s[MAX_N + 1];
vector<int> score;
bool C(int r, int x){
int inc = 0;
vector<int>::iterator it = score.begin();
for(int i = 1; i <= N; i++){
//p = 0;
while(it != score.end()){
if(*it < s[i]) it++;
else{
if(*it - s[i] <= r){
inc++;
break;
}
else break;
}
}
}
return N - inc <= x;
}
int main(){
int Q, a;
bool change;
char str[10];
scanf("%d%d", &N, &Q);
for(int i = 1; i <= N; i++){
scanf("%d", &input[i]);
s[i] = input[i];
}
sort(s + 1, s + N + 1);
for(int i = 0; i < Q; i++){
scanf("%s%d", str, &a);
if(strcmp(str, "ADD") == 0){
score.push_back(input[a]);
}
else if(strcmp(str, "REMOVE") == 0){
vector<int>::iterator it = score.begin();
for(; *it != input[a] && it != score.end(); it++);
score.erase(it);
}
else if(strcmp(str, "CHECK") == 0){
if(a == N){
printf("0\n");
continue;
}
if(score.empty()){
printf("NA\n");
continue;
}
sort(score.begin(), score.end());
/*
rの値を大きくしていくほど仲間はずれになる生徒の人数は
少なくなっていくので、二分探索が適用できる
*/
int lb = -1, rb = score[score.size() - 1];
change = false;
while(rb - lb > 1){
int mid = (lb + rb + 1) / 2;
if(C(mid, a)){
change = true;
rb = mid;
}
else lb = mid;
}
if(change) printf("%d\n", rb);
else printf("NA\n");
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:20: error: 'strcmp' was not declared in this scope
46 | if(strcmp(str, "ADD") == 0){
| ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <vector>
+++ |+#include <cstring>
5 | using namespace std;
|
s759840711 | p00278 | C++ | #include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define MAX_N 1000000
int N;
int input[MAX_N + 1], s[MAX_N + 1];
vector<int> score;
bool C(int r, int x){
int inc = 0;
vector<int>::iterator it = score.begin();
for(int i = 1; i <= N; i++){
//p = 0;
while(it != score.end()){
if(*it < s[i]) it++;
else{
if(*it - s[i] <= r){
inc++;
break;
}
else break;
}
}
}
return N - inc <= x;
}
int main(){
int Q, a;
bool change;
char str[10];
scanf("%d%d", &N, &Q);
for(int i = 1; i <= N; i++){
scanf("%d", &input[i]);
s[i] = input[i];
}
sort(s + 1, s + N + 1);
for(int i = 0; i < Q; i++){
scanf("%s%d", str, &a);
if(strcmp(str, "ADD") == 0){
score.push_back(input[a]);
}
else if(strcmp(str, "REMOVE") == 0){
vector<int>::iterator it = score.begin();
for(; *it != input[a] && it != score.end(); it++);
score.erase(it);
}
else if(strcmp(str, "CHECK") == 0){
if(a == N){
printf("0\n");
continue;
}
if(score.empty()){
printf("NA\n");
continue;
}
sort(score.begin(), score.end());
/*
rの値を大きくしていくほど仲間はずれになる生徒の人数は
少なくなっていくので、二分探索が適用できる
*/
int lb = -1, rb = score[score.size() - 1];
change = false;
while(rb - lb > 1){
int mid = (lb + rb + 1) / 2;
if(C(mid, a)){
change = true;
rb = mid;
}
else lb = mid;
}
if(change) printf("%d\n", rb);
else printf("NA\n");
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:20: error: 'strcmp' was not declared in this scope
46 | if(strcmp(str, "ADD") == 0){
| ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <vector>
+++ |+#include <cstring>
5 | using namespace std;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.