submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s489326707
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int l[n];
for(int i = 0; i < n; i++) {
cin >> l[i];
}
sort(l, l + n);
int ans = 0;
for(int i = 0; i < l / 2; i+=2) {
ans += min(l[i], l[i+1]);
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:13:26: error: invalid operands of types 'int [n]' and 'int' to binary 'operator/'
13 | for(int i = 0; i < l / 2; i+=2) {
| ~ ^ ~
| | |
| | int
| int [n]
|
s608956511
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
vector<int> a(2*n);
for(int i=0;i<2*n;++i)cin>>a[i];
sort(a.begin(),a.end());
int64_t ans=0;
for(int i=0;i<n;++i)
ans+=mn(a[2*i],a[i*2+1]);
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:11:10: error: 'mn' was not declared in this scope; did you mean 'n'?
11 | ans+=mn(a[2*i],a[i*2+1]);
| ^~
| n
|
s642486857
|
p04047
|
C++
|
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
int n,a[200],ans=0;
cin >> n;
for(int i=0; i<2*n; i++) {
cin >> a[i];
}
sort(a,a+2*n);
for(int i=0; i<2*n i+=2) {
ans+=a[i];
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:12:21: error: expected ';' before 'i'
12 | for(int i=0; i<2*n i+=2) {
| ^~
| ;
|
s621842914
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int> stick(N);
rep(i, N) cin >> stick[i];
vector<int> sum(N / 2);
sort(stick.begin(), stick.end());
rep(i, N / 2){ sum[i] = stick[2 * i];}
int price_sum = 0;
rep(i, N / 2){
price_sum = sum[i];
}
cout << price_sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:10:13: error: 'i' was not declared in this scope
10 | rep(i, N) cin >> stick[i];
| ^
a.cc:10:9: error: 'rep' was not declared in this scope
10 | rep(i, N) cin >> stick[i];
| ^~~
|
s703596819
|
p04047
|
C++
|
#include <vector>
#include <iostream>
#include <cmath>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
int main() {
int N;
cin>>N;
int i = 0;
int max = 0,sum = 0;
vector<int> p(2*N);
while(i < 2*N)
{
cin >> p[i];
i++;
}
sort(p.begin(),p.end());
i = 0;
while(i < N)
{
sum = p[2*i + 1] + sum;
}
cout<<sum<<endl;
}
|
a.cc: In function 'int main()':
a.cc:37:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
37 | sort(p.begin(),p.end());
| ^~~~
| sqrt
|
s194068414
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
std::vector<int> stick(N);
rep(i, N) cin >> stick(i);
vector<int> sum(N / 2);
sort(stick.begin(), stick.end());
rep(i, N / 2){ sum[i] = stick[2 * i];}
int price_sum = 0;
rep(i, N / 2){
price_sum = sum[i];
}
cout << price_sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:10:13: error: 'i' was not declared in this scope
10 | rep(i, N) cin >> stick(i);
| ^
a.cc:10:9: error: 'rep' was not declared in this scope
10 | rep(i, N) cin >> stick(i);
| ^~~
|
s907043380
|
p04047
|
C++
|
あ
|
a.cc:1:1: error: '\U00003042' does not name a type
1 | あ
| ^~
|
s611035637
|
p04047
|
Java
|
import java.util.Arrays;
import java.util.Scanner;
public class BBQEasy {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int [] arr = new int[n*2];
for (int i = 0; i < n*2; i++) {
arr[i] = scanner.nextInt();
}
Arrays.sort(arr);
int sum = 0;
for (int i = 1; i < n*2; i+=2) {
sum += Math.min(arr[i-1], arr[i]);
}
System.out.println(sum);
}
}
|
Main.java:4: error: class BBQEasy is public, should be declared in a file named BBQEasy.java
public class BBQEasy {
^
1 error
|
s802197365
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, S = 0;
cin >> N;
vector<int> vec;
for (int i = 0; i < N * 2; i++) {
cin >> vec.at(i);
}
sort(vec.begin(), vec.end);
for (int i = 0; i < N; i++) {
S += vec.at(i * 2);
}
cout << S << endl;
}
|
a.cc: In function 'int main()':
a.cc:13:7: error: no matching function for call to 'sort(std::vector<int>::iterator, <unresolved overloaded function type>)'
13 | sort(vec.begin(), vec.end);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~
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:4762:5: note: candidate: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:63: note: no known conversion for argument 2 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/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
|
s200208015
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, S = 0;
cin >> N;
vector<int> vec(N * 2)
for (int i = 0; i < N * 2; i++) {
cin >> vec.at(i);
}
for (int i = 0; i < N; i++) {
S += vec.at(i * 2);
}
cout << S << endl;
}
|
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
9 | for (int i = 0; i < N * 2; i++) {
| ^~~
a.cc:9:19: error: 'i' was not declared in this scope
9 | for (int i = 0; i < N * 2; i++) {
| ^
|
s561808535
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, S = 0;
cin >> N;
vector<int> vec(N)
for (int i = 0; i < N * 2; i++) {
cin >> vec.at(i);
}
for (int i = 0; i < N; i++) {
S += vec.at(i * 2);
}
cout << S << endl;
}
|
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
9 | for (int i = 0; i < N * 2; i++) {
| ^~~
a.cc:9:19: error: 'i' was not declared in this scope
9 | for (int i = 0; i < N * 2; i++) {
| ^
|
s844886681
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, S = 0;
cin >> N;
vector<int> vec(N)
for (int i = 0; i < 2N; i++) {
cin >> vec.at(i);
}
for (int i = 0; i < N; i++) {
S += vec.at(i * 2);
}
cout << S << endl;
}
|
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
9 | for (int i = 0; i < 2N; i++) {
| ^~~
a.cc:9:19: error: 'i' was not declared in this scope
9 | for (int i = 0; i < 2N; i++) {
| ^
a.cc:9:23: error: unable to find numeric literal operator 'operator""N'
9 | for (int i = 0; i < 2N; i++) {
| ^~
|
s162583517
|
p04047
|
C++
|
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;
int main() {
ll N;
cin >> N;
ll ans = 0;
vector<ll> L(N);
rep(i,N){
cin >> L[i];
}
sort(all(N));
rep(i,N-1){
ans += min(L[i],L[i+1]);
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:2:20: error: request for member 'begin' in 'N', which is of non-class type 'll' {aka 'long long int'}
2 | #define all(x) (x).begin(),(x).end()
| ^~~~~
a.cc:29:14: note: in expansion of macro 'all'
29 | sort(all(N));
| ^~~
a.cc:2:32: error: request for member 'end' in 'N', which is of non-class type 'll' {aka 'long long int'}
2 | #define all(x) (x).begin(),(x).end()
| ^~~
a.cc:29:14: note: in expansion of macro 'all'
29 | sort(all(N));
| ^~~
|
s860962390
|
p04047
|
C++
|
test
|
a.cc:1:1: error: 'test' does not name a type
1 | test
| ^~~~
|
s450759416
|
p04047
|
C++
|
test
|
a.cc:1:1: error: 'test' does not name a type
1 | test
| ^~~~
|
s557511929
|
p04047
|
C++
|
test
|
a.cc:1:1: error: 'test' does not name a type
1 | test
| ^~~~
|
s683789599
|
p04047
|
C++
|
test
|
a.cc:1:1: error: 'test' does not name a type
1 | test
| ^~~~
|
s492710755
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
int a[2*N];
for(int i = 0;i<2*N;i++){
cin >> a[i];
}
sort(a.begin(),a.end());
int ans = 0;
for(int i = 0;i<N;i++){
ans = ans + a[i*2];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:10:10: error: request for member 'begin' in 'a', which is of non-class type 'int [(N * 2)]'
10 | sort(a.begin(),a.end());
| ^~~~~
a.cc:10:20: error: request for member 'end' in 'a', which is of non-class type 'int [(N * 2)]'
10 | sort(a.begin(),a.end());
| ^~~
|
s256077487
|
p04047
|
C++
|
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main() {
int n;
cin>>n;
int k[2*n];
for(int i=0;i<2*n;i++)
cin>>k[i];
sort(k;k+2*n);
int res=0;
for(int i=0;i<=2*n;i+=2){
res+=k[i];}
cout<<res<<endl;
}
|
a.cc: In function 'int main()':
a.cc:14:9: error: expected ')' before ';' token
14 | sort(k;k+2*n);
| ~ ^
| )
a.cc:14:15: error: expected ';' before ')' token
14 | sort(k;k+2*n);
| ^
| ;
|
s070817309
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i=0;i<m;i++)
int main(){
int n; cin>>n;
vector<int> length(2*n);
int i,ans=0;
rep(i,2*n){cin>>length[i];}
sort(length.begin(),length.end());
rep(i,2*n){if(i%2==1){ans+=length[i];}}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:3:28: error: 'm' was not declared in this scope
3 | #define rep(i,n) for(i=0;i<m;i++)
| ^
a.cc:8:3: note: in expansion of macro 'rep'
8 | rep(i,2*n){cin>>length[i];}
| ^~~
a.cc:3:28: error: 'm' was not declared in this scope
3 | #define rep(i,n) for(i=0;i<m;i++)
| ^
a.cc:10:3: note: in expansion of macro 'rep'
10 | rep(i,2*n){if(i%2==1){ans+=length[i];}}
| ^~~
|
s853224858
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i=0;i<m;i++)
int main(){
int n; cin>>n;
vector<int> length(2n);
int i,ans=0;
rep(i,2n){cin>>length[i];}
sort(length.begin(),length.end());
rep(i,2n){if(i%2==1){ans+=length[i];}}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:6:22: error: unable to find numeric literal operator 'operator""n'
6 | vector<int> length(2n);
| ^~
a.cc:3:28: error: 'm' was not declared in this scope
3 | #define rep(i,n) for(i=0;i<m;i++)
| ^
a.cc:8:3: note: in expansion of macro 'rep'
8 | rep(i,2n){cin>>length[i];}
| ^~~
a.cc:3:28: error: 'm' was not declared in this scope
3 | #define rep(i,n) for(i=0;i<m;i++)
| ^
a.cc:10:3: note: in expansion of macro 'rep'
10 | rep(i,2n){if(i%2==1){ans+=length[i];}}
| ^~~
|
s007806335
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=2*n;i++) scanf("%d",&a[i]);
sort(a+1,a+1+2*n);
for(int i=1;i<=2*n;i+=2) ans+=min(a[i],a[i+1]);
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:10:30: error: 'ans' was not declared in this scope; did you mean 'abs'?
10 | for(int i=1;i<=2*n;i+=2) ans+=min(a[i],a[i+1]);
| ^~~
| abs
a.cc:11:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | cout<<ans<<endl;
| ^~~
| abs
|
s297630534
|
p04047
|
C++
|
RinanoMBP:20190216 rinaonda$ vi BBQ_Easy.cpp
#include <iostream>
#include <vector>
#include <algorithm>
int main(){
int N;
std::cin >> N;
std::vector<int> L;
for(int i=0; i<2*N; ++i){
int l = 0;
std::cin >> l;
L.push_back(l);
}
if(L.size()!=2*N) return -1;
std::sort(L.begin(),L.end());
int sum = 0;
while(L.size()>0){
sum += L.at(L.size()-2);
L.pop_back();
L.pop_back();
}
std::cout << sum << std::endl;
return 0;
}
|
a.cc:1:1: error: 'RinanoMBP' does not name a type
1 | RinanoMBP:20190216 rinaonda$ vi BBQ_Easy.cpp
| ^~~~~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:3:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you m
|
s453526483
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,l[1000],v=0;
cin >> n;
n*=2;
for(int i=0;i<n;i++){
cin >> l[i];
}
sort(l,l+n,greater<int>);
for(int i=0;i<n;i++){
if(i%2==1){
v+=l[i];
}
}
cout << v << endl;
}
|
a.cc: In function 'int main()':
a.cc:11:26: error: expected primary-expression before ')' token
11 | sort(l,l+n,greater<int>);
| ^
|
s395975933
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a=0;
vector<int> s(2*n);
for(int i=0;i<2*n;i++){
cin>>s[i];
}
sort(s.begin(),s.end());
for(int i=0;i<2*n;i+=2;){
a+=min(s[i],s[i+1]);
}
cout<<a<<endl;
}
|
a.cc: In function 'int main()':
a.cc:13:31: error: expected ')' before ';' token
13 | for(int i=0;i<2*n;i+=2;){
| ~ ^
| )
a.cc:13:32: error: expected primary-expression before ')' token
13 | for(int i=0;i<2*n;i+=2;){
| ^
|
s800177960
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int N;
int main(){
cin >> N;
int kusi[n*2];
for(int i=0;i!=2*N;i++){
cin >> kusi[i];
}
sort(kusi,kusi+(2*N),greater<int>());
int ans=0;
for(int i=0;i!=N*2;i+=2){
ans+=kusi[i+1];
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:7:12: error: 'n' was not declared in this scope
7 | int kusi[n*2];
| ^
a.cc:9:12: error: 'kusi' was not declared in this scope
9 | cin >> kusi[i];
| ^~~~
a.cc:11:8: error: 'kusi' was not declared in this scope
11 | sort(kusi,kusi+(2*N),greater<int>());
| ^~~~
|
s877223159
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int N;
int kusi[102];
int main(){
cin >> N;
for(int i=0;i!=2*N;i++){
cin >> kusi[i];
}
sort(kusi,kusi+2*N;
int ans=0;
for(int i=0;i!=N;i++){
ans+=kusi[2*i];
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:11:21: error: expected ')' before ';' token
11 | sort(kusi,kusi+2*N;
| ~ ^
| )
|
s697979568
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int N;
vector<int> kusi;
int main(){
cin >> N;
for(int i=0;i!=2N;i++){
cin >> kusi.at(i);
}
sort(kusi.begin(),kusi.end());
int ans=0;
for(int i=0;i!=N;i++){
ans+=kusi.at(2*i);
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:8:18: error: unable to find numeric literal operator 'operator""N'
8 | for(int i=0;i!=2N;i++){
| ^~
|
s480775230
|
p04047
|
C++
|
#include<bits/stdc++>
using namespace std;
int N;
vector<int> kusi;
int main(){
cin >> N;
for(int i=0;i!=2N;i++){
cin >> kusi.at(i);
}
sort(kusi.begin(),kusi.end());
int ans=0;
for(int i=0;i!=N;i++){
ans+=kusi.at(2*i);
}
cout << ans << endl;
}
|
a.cc:1:9: fatal error: bits/stdc++: No such file or directory
1 | #include<bits/stdc++>
| ^~~~~~~~~~~~~
compilation terminated.
|
s083305757
|
p04047
|
C
|
int main(){
int N,tmp,cnt;
int L[100];
int i,p,q;
scanf("%d", &N);
for( i=0; i<N*2; i++ ){
scanf("%d ",&L[i]);
}
//降順ソート
for( p = 0; p < N*2; p++){
for(q = p + 1; q < (N*2)+1; q++){
if(L[p] < L[q]){
tmp = L[p];
L[p] = <[q];
L[q] = tmp;
}
}
}
//最大数の和を求める
for( i= 0; i<N*2; i++ ){
cnt += L[i+1];
}
printf("%d",cnt);
return 0;
}
|
main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
6 | scanf("%d", &N);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main(){
main.c:6:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
6 | scanf("%d", &N);
| ^~~~~
main.c:6:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:19:40: error: expected expression before '<' token
19 | L[p] = <[q];
| ^
main.c:30:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
30 | printf("%d",cnt);
| ^~~~~~
main.c:30:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:30:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:30:9: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s749669511
|
p04047
|
C
|
int main(){
int N,tmp,cnt;
int L[100];
int i,p,q
scanf("%d", &N)
for( i=0; i<N*2; i++ ){
scanf("%d ",&L[i]);
}
//降順ソート
for( p = 0; p < N*2; p++){
for(q = p + 1; q < (N*2)+1; q++){
if(L[p] < L[q]){
tmp = L[p];
L[p] = <[q];
L[q] = tmp;
}
}
}
//最大数の和を求める
for( i= 0; i<N*2; i++ ){
cnt += L[i+1];
}
printf("%d",cnt);
return 0;
}
|
main.c: In function 'main':
main.c:6:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'scanf'
6 | scanf("%d", &N)
| ^~~~~
main.c:10:29: error: expected ';' before ')' token
10 | for( i=0; i<N*2; i++ ){
| ^~
| ;
main.c:10:30: error: expected statement before ')' token
10 | for( i=0; i<N*2; i++ ){
| ^
main.c:11:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
11 | scanf("%d ",&L[i]);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main(){
main.c:11:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
11 | scanf("%d ",&L[i]);
| ^~~~~
main.c:11:17: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:16:21: error: 'q' undeclared (first use in this function)
16 | for(q = p + 1; q < (N*2)+1; q++){
| ^
main.c:16:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:40: error: expected expression before '<' token
19 | L[p] = <[q];
| ^
main.c:30:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
30 | printf("%d",cnt);
| ^~~~~~
main.c:30:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:30:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:30:9: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s711609168
|
p04047
|
C
|
#include<stdio.h>
int main(){
int N,tmp,cnt
int L[100];
scanf("%d", &N)
for( int i=0; i<N*2; i++ ){
scanf("%d ",&L[i]);
}
//降順ソート
for(int p = 0; p < N*2; p++){
for(int q = p + 1; q < (N*2)+1; q++){
if(L[p] < L[q]){
tmp = L[p];
L[p] = <[q];
L[q] = tmp;
}
}
}
//最大数の和を求める
for( int i= 0; i<N*2; i++ ){
cnt += L[i+1];
}
printf("%d",cnt);
return 0;
}
|
main.c: In function 'main':
main.c:5:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
5 | int L[100];
| ^~~
main.c:7:24: error: expected ';' before 'for'
7 | scanf("%d", &N)
| ^
| ;
8 |
9 | for( int i=0; i<N*2; i++ ){
| ~~~
|
s534547230
|
p04047
|
C
|
#include <stdio.h>
void main()
{int a[200],length,result,error,n2;
error=scanf("%d",&length);
n2=length*2;
for (i=0;i++;i<n2) error=scanf("%d",&a[i]);
for(int i=0;i<n2;i++)
{
for(int j=n2-1;j>i;j--)
{
if(a[j]<a[j-1])
{
int t=a[j];
a[j]=a[j-1];
a[j-1]=t;
}
}
}
for(result=0,i=0;i<n2;i=i+2)
result=result+a[i];
printf( "%d", result );
}
|
main.c: In function 'main':
main.c:8:6: error: 'i' undeclared (first use in this function)
8 | for (i=0;i++;i<n2) error=scanf("%d",&a[i]);
| ^
main.c:8:6: note: each undeclared identifier is reported only once for each function it appears in
|
s599555862
|
p04047
|
C
|
#include <stdio.h>
void main()
{int i,j,a[100],length,result,error,scanf(),printf();
error=scanf("%d",&length);
for (i=0;i++;i<100) error=scanf("%d",&a[i]);
for(int i=0;i<length-1;i++)
{
for(int j=length-1;j>i;j--)
{
if(a[j]<a[j-1])
{
int t=a[j];
a[j]=a[j-1];
a[j-1]=t;
}
}
}
for(int i=0;i<length;i=i+2)
result=result+a[i];
printf( "%d", result );
}
|
main.c: In function 'main':
main.c:4:37: error: conflicting types for 'scanf'; have 'int()'
4 | {int i,j,a[100],length,result,error,scanf(),printf();
| ^~~~~
main.c:4:1: note: a parameter list with an ellipsis cannot match an empty parameter name list declaration
4 | {int i,j,a[100],length,result,error,scanf(),printf();
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/stdio.h:28,
from main.c:1:
/usr/include/stdio.h:466:12: note: previous declaration of 'scanf' with type 'int(const char *, ...)'
466 | extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
| ^~~~~~~~~~
main.c:4:45: error: conflicting types for 'printf'; have 'int()'
4 | {int i,j,a[100],length,result,error,scanf(),printf();
| ^~~~~~
main.c:4:1: note: a parameter list with an ellipsis cannot match an empty parameter name list declaration
4 | {int i,j,a[100],length,result,error,scanf(),printf();
| ^
/usr/include/stdio.h:363:12: note: previous declaration of 'printf' with type 'int(const char *, ...)'
363 | extern int printf (const char *__restrict __format, ...);
| ^~~~~~
|
s110508059
|
p04047
|
Java
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
// Nを取り出す
int N = Integer.parseInt(line);
// L1... を取り出す
line = sc.nextLine();
String[] l1l2 = line.split(" ");
List<Integer> kusi = new ArrayList<>();
for(int i = 0; i < l1l2.length; i++ ) {
kusi.add(Integer.parseInt(l1l2[i]);
}
Collections.sort(kusi);
calc(kusi);
}
// 計算する
public static calc(List<integer> list) {
int total = 0;
for(int i = 0; i < list.size(); i=i+2) {
total += list.get(i);
}
System.out.println(total);
}
}
|
Main.java:18: error: ')' or ',' expected
kusi.add(Integer.parseInt(l1l2[i]);
^
Main.java:27: error: invalid method declaration; return type required
public static calc(List<integer> list) {
^
2 errors
|
s929236957
|
p04047
|
C
|
#include <stdio.h>
main()
{int a[100],length;
scanf("%d",length);
for (i=0;i++;i<100) scanf("%d",&a[i]);
for(int i=0;i<length-1;i++)
{
for(int j=a.length-1;j>i;j--){
if(a[j]<a[j-1]){
int t=a[j];
a[j]=a[j-1];
a[j-1]=t;
}
}
for(int i=0;i<length;i=i+2)
result=result+a[i];
printf( "\n", result );
}
|
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main()
| ^~~~
main.c: In function 'main':
main.c:8:6: error: 'i' undeclared (first use in this function)
8 | for (i=0;i++;i<100) scanf("%d",&a[i]);
| ^
main.c:8:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:18: error: request for member 'length' in something not a structure or union
12 | for(int j=a.length-1;j>i;j--){
| ^
main.c:22:9: error: 'result' undeclared (first use in this function)
22 | result=result+a[i];
| ^~~~~~
main.c:25:1: error: expected declaration or statement at end of input
25 | }
| ^
|
s506853828
|
p04047
|
C
|
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int arr[205];
int main()
{
int n;
int res=0;
scanf("%d",&n);
int m=2*n;
for(int i=1;i<=m;i++)
{
scanf("%d",&arr[i]);
}
sort(arr+1,arr+m+1);
int k;
for(int j=1;j<=m;j=j+2)
{
k=arr[j];
res=res+k;
}
printf("%d\n",res);
}
|
main.c:3:9: fatal error: algorithm: No such file or directory
3 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s487193357
|
p04047
|
C++
|
#include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
N *= 2;
vector<int> L(N);
for (int i = 0; i < N; i++) {
cin >> L[i];
}
}
sort(L.begin(), L.end());
int ans = 0;
for (int i = 0; i < N; i += 2) {
ans += L[i];
}
cout << ans << endl;
}
|
a.cc:14:9: error: expected constructor, destructor, or type conversion before '(' token
14 | sort(L.begin(), L.end());
| ^
a.cc:16:5: error: expected unqualified-id before 'for'
16 | for (int i = 0; i < N; i += 2) {
| ^~~
a.cc:16:21: error: 'i' does not name a type
16 | for (int i = 0; i < N; i += 2) {
| ^
a.cc:16:28: error: 'i' does not name a type
16 | for (int i = 0; i < N; i += 2) {
| ^
a.cc:19:5: error: 'cout' does not name a type
19 | cout << ans << endl;
| ^~~~
a.cc:20:1: error: expected declaration before '}' token
20 | }
| ^
|
s158122613
|
p04047
|
C++
|
#include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
N *= 2;
vector<int> L(N) {
for (int i = 0; i < N; i++) {
cin >> L[i];
}
}
sort(L.begin(), L.end());
int ans = 0;
for (int i = 0; i < N; i += 2) {
ans += L[i];
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:8:22: error: expected ',' or ';' before '{' token
8 | vector<int> L(N) {
| ^
|
s541434732
|
p04047
|
C++
|
#include<iostream>
#include<algorithm>
using namespace std;
int a[110];
int main(){
int a,k;
cin>>a;
int b=a*2;
for(int i=0;i<b;i++){
cin>>a[i];
sort(a,a+b);
}
for(int i=0;i<a+1;i++){
k+=a[i*2];
}
cout<<k<<endl;
}
|
a.cc: In function 'int main()':
a.cc:10:11: error: invalid types 'int[int]' for array subscript
10 | cin>>a[i];
| ^
a.cc:14:9: error: invalid types 'int[int]' for array subscript
14 | k+=a[i*2];
| ^
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:9: required from here
11 | sort(a,a+b);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int')
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int')
1782 | *__first = _GLIBCXX_MOVE(__val);
| ^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/string:51,
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:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]':
/usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1777 | if (__comp(__i, __first))
| ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:9: required from here
11 | sort(a,a+b);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int')
45 | { return *__it1 < *__it2; }
| ^~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int')
45 | { return *__it1 < *__it2; }
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algo.h:61:
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1593 | std::__make_heap(__first, __middle, __comp);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:9: required from here
11 | sort(a,a+b);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
344 | _ValueType;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
346 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1596 | std::__pop_heap(__first, __middle, __i, __comp);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:9: required from here
11 | sort(a,a+b);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
258 | _ValueType;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:260:9: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
260 |
|
s918150410
|
p04047
|
C++
|
#include<iostream>
#include<algorithm>
using namespace std;
int a[110];
int main(){
int a,k;
cin>>a;
int b=a*2
for(int i=0;i<b;i++){
cin>>a[i];
sort(a,a+b);
}
for(int i=0;i<a+1;i++){
k+=a[i*2];
}
cout<<k<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
9 | for(int i=0;i<b;i++){
| ^~~
a.cc:9:15: error: 'i' was not declared in this scope
9 | for(int i=0;i<b;i++){
| ^
a.cc:14:9: error: invalid types 'int[int]' for array subscript
14 | k+=a[i*2];
| ^
|
s507077493
|
p04047
|
C++
|
#include<iostream>
#include<algorithm>
using namespace std;
int a[110];
int main(){
int a,k;
cin>>a;
int b=a*2
for(int i=0;i<b;i++){
cin>>a[i];
sort(a,a+b);
}
for(int i=0;i<a+1;i++){
k+=a[i*2;
}
cout<<k<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
9 | for(int i=0;i<b;i++){
| ^~~
a.cc:9:15: error: 'i' was not declared in this scope
9 | for(int i=0;i<b;i++){
| ^
a.cc:14:13: error: expected ']' before ';' token
14 | k+=a[i*2;
| ^
| ]
a.cc:14:9: error: invalid types 'int[int]' for array subscript
14 | k+=a[i*2;
| ^
|
s798232598
|
p04047
|
C
|
#include<stdio.h>
#include<stdlib.h>
///*
void sort_N(int *x,int n);
int main() {
int i, n, *ary;
int counter=0;
scanf("%d", &n);
ary = (int*)calloc(2 * n, sizeof(int));
if (ary == NULL) {
return 0;
}
for (i = 0; i < 2 * n; i++) {
scanf_s("%d", &ary[i]);
}
sort_N(ary, 2 * n);
for (i = 0; i < n; i++) {
counter += ary[2 * i];
}
for (i = 0; i < 2 * n; i++) {
printf("%d ", ary[i]);
}
printf("\n");
printf("%d\n", counter);
free(ary);
return 0;
}
void sort_N(int *x,int n) {
int i,j,fake;
for (i = 0; i < n - 1; i++) {
for (j = 0; j < n - 1;j++){
if (x[j] > x[j + 1]) {
fake = x[j];
x[j] = x[j + 1];
x[j + 1] = fake;
}
}
}
}
//*/
|
main.c: In function 'main':
main.c:19:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
19 | scanf_s("%d", &ary[i]);
| ^~~~~~~
| scanf
|
s425979854
|
p04047
|
C
|
#include<stdio.h>
#include<stdlib.h>
void sort_N(int *x,int n);
int main() {
int i, n, *ary;
int counter=0;
scanf_s("%d", &n);
ary = (int*)calloc(2 * n, sizeof(int));
if (ary == NULL) {
return 0;
}
for (i = 0; i < 2 * n; i++) {
scanf_s("%d", &ary[i]);
}
sort_N(ary, 2 * n);
for (i = 0; i < n; i++) {
counter += ary[2 * i];
}
for (i = 0; i < 2 * n; i++) {
printf("%d ", ary[i]);
}
printf("\n");
printf("%d\n", counter);
free(ary);
return 0;
}
void sort_N(int *x,int n) {
int i,j,fake;
for (i = 0; i < n - 1; i++) {
for (j = 0; j < n - 1;j++){
if (x[j] > x[j + 1]) {
fake = x[j];
x[j] = x[j + 1];
x[j + 1] = fake;
}
}
}
}
|
main.c: In function 'main':
main.c:11:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
11 | scanf_s("%d", &n);
| ^~~~~~~
| scanf
|
s267329351
|
p04047
|
C++
|
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;
int mian()
{
int n,a[100001],s=0;
cin>>n;
for(int i=0;i<2*n;i++)
cin>>a[i];
sort(a,a+2*n);
for(int i=0;i<2*n;i+=2)
s+=a[i];
cout<<s;
}
|
a.cc: In function 'int mian()':
a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
18 | }
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s563188737
|
p04047
|
C++
|
#include <stdio.h>
#include <algorithm>
using namespace std;
int l[300];
int main () {
int n;
cin >> n;
for (int i = 0; i < 2 * n; ++i) {
cin >> l[i];
}
sort(l, l + 2 * n);
int sum = 0;
for (int i = 0; i < 2 * n; i += 2) {
sum += l[i];
}
cout << sum << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
9 | cin >> n;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <algorithm>
+++ |+#include <iostream>
3 | using namespace std;
a.cc:18:9: error: 'cout' was not declared in this scope
18 | cout << sum << endl;
| ^~~~
a.cc:18:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:24: error: 'endl' was not declared in this scope
18 | cout << sum << endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include <algorithm>
+++ |+#include <ostream>
3 | using namespace std;
|
s440550356
|
p04047
|
C++
|
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
int used,n,l[300],max,res = 0;
cin >> n;
for(int i = 0; i < n*2; i++) cin >> l[i];a
for(int j = 0; j < n*2; j++){
max = 0;
for(int i = 0; i < n*2; i++){
if(l[i] > max){
max = l[i];
used = i;
}
}
if((j+1) % 2 == 0) res += max;
l[used] = -1;
}
cout << res << endl;
return 0;
}
|
a.cc: In function 'int main(int, char**)':
a.cc:7:50: error: 'a' was not declared in this scope
7 | for(int i = 0; i < n*2; i++) cin >> l[i];a
| ^
a.cc:8:24: error: 'j' was not declared in this scope
8 | for(int j = 0; j < n*2; j++){
| ^
|
s253189698
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,x;
ll get(ll x,ll y){
ll a=min(x,y),b=max(x,y);
if (a==0)return -b;
return get(a,b%a)+2*a*(b/a);
}
signed main(){
scanf("%lld%lld",&n,&x);
prllf("%lld\n",get(x,n-x)+n);
}
|
a.cc: In function 'int main()':
a.cc:12:9: error: 'prllf' was not declared in this scope
12 | prllf("%lld\n",get(x,n-x)+n);
| ^~~~~
|
s345607950
|
p04047
|
C++
|
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<set>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
#define Rep(i,s,t) for(register int i=s;i<t;++i)
#define go(x) for(register int e=las[x];e;e=nxt[e])
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
#define ms(f,x) memset(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
namespace IO{
#define gc getchar()
#define pc(x) putchar(x)
template<typename T>inline void read(T &x){
x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
}
template<typename T>inline void write(T x=0){
T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);
putchar('\n');
return;
}
}
using IO::read;
using IO::write;
int a[2*n];
long long sum;
int main(){
gi(n);
rep(i,1,n+n)
gi(a[i]);
sort(a+1,a+n+n+1);
for(int i=1;i<=n;i+=2)
sum+=a[i];
cout<<sum<<endl;
return 0;
}
|
a.cc:37:9: error: 'n' was not declared in this scope
37 | int a[2*n];
| ^
a.cc: In function 'int main()':
a.cc:40:8: error: 'n' was not declared in this scope
40 | gi(n);
| ^
a.cc:16:20: note: in definition of macro 'gi'
16 | #define gi(x) read(x)
| ^
a.cc:41:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
41 | rep(i,1,n+n)
| ^
a.cc:6:37: note: in definition of macro 'rep'
6 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
| ^
a.cc:42:12: error: 'a' was not declared in this scope
42 | gi(a[i]);
| ^
a.cc:16:20: note: in definition of macro 'gi'
16 | #define gi(x) read(x)
| ^
a.cc:43:10: error: 'a' was not declared in this scope
43 | sort(a+1,a+n+n+1);
| ^
a.cc:43:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
43 | sort(a+1,a+n+n+1);
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
a.cc:46:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
46 | cout<<sum<<endl;
| ^~~~
| std::cout
In file included from a.cc:3:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:46:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
46 | cout<<sum<<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)
| ^~~~
|
s540470323
|
p04047
|
C
|
#include<stdio.h>
int fact(int n);
int main()
{
int n,i,j,sum=0;
scanf("%d",&n);
int a[n],b[n];
for(int i=0;i<n;i++)
{
scanf("%d%d",&a[i],&b[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
sum+=fact((a[i]+b[i]+a[j]+b[j]),a[i]+b[i]);
}
}
printf("%d",sum);
return 0;
}
int fact(int n,int r)
{
if(n==r)
return 1;
else if(r==1)
return n;
else
return (fact(n-1,r)+fact(n-1,r-1));
}
|
main.c: In function 'main':
main.c:16:6: error: too many arguments to function 'fact'
16 | sum+=fact((a[i]+b[i]+a[j]+b[j]),a[i]+b[i]);
| ^~~~
main.c:2:5: note: declared here
2 | int fact(int n);
| ^~~~
main.c: At top level:
main.c:22:5: error: conflicting types for 'fact'; have 'int(int, int)'
22 | int fact(int n,int r)
| ^~~~
main.c:2:5: note: previous declaration of 'fact' with type 'int(int)'
2 | int fact(int n);
| ^~~~
|
s011722584
|
p04047
|
C
|
#include<stdio.h>
int main()
{
int n,temp,sum=0;
scanf("%d",&n);
int l[2*n];
for(int i=0;i<2*n;i++)
{
scanf("%d",&l[i]);
}
for(int i=0;i<2*n;i++)
{
for(int j=0;j<(2*n-i-1);j++)
{
if(l[j]>l[j+1]
{
temp=l[j];
l[j]=l[j+1];
l[j+1]=temp;
}
}
}
for(int i=0;i<2*n;i=i+2)
{
sum=sum+l[i];
}
printf("%d",sum);
return 0;
}
|
main.c: In function 'main':
main.c:15:22: error: expected ')' before '{' token
15 | if(l[j]>l[j+1]
| ~ ^
| )
16 | {
| ~
main.c:21:10: error: expected expression before '}' token
21 | }
| ^
|
s227610789
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n >> x;
cout << 3 * (n - _gcd(n, x))<< '\n';
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:22: error: '_gcd' was not declared in this scope
8 | cout << 3 * (n - _gcd(n, x))<< '\n';
| ^~~~
|
s176295001
|
p04047
|
C++
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
struct node{
char name[30];
long num;
struct node *next;};
typedef struct node NODE;
NODE *start, *end, *gnode();
void menu(void)
{
printf("\n\n");
printf("\e[10C Load Data ==> .L\n");
printf("\e[10C Find Data ==> .F\n");
printf("\e[10C Quit ==> .Q\n");
printf("\e[12C");
printf("Enter Command >>");
}
NODE *gnode()
{
NODE *p;
p = malloc(sizeof(NODE));
if (p == NULL )
printf("Not enouph memry\n");
return p;
}
void printlist()
{
NODE *p;
printf("\n\nContents:\n\n");
p = start;
while (p != end){
printf("%8ld %-40s %p\n", p->num, p->name, p->next);
p = p->next;
}
menu();
}
void loadlist()
{
NODE *p;
char str[100];
printf("\e[12C =>");
scanf("%s",str);
p=end;
end=gnode();
p->next=end;
strcpy(p->name,str);
menu();
}
void finddata(){
printf("\e[12C =>");
char str[100];
scanf("%s",str);
}
void bye(void)
{
printf("\e[0m");
exit(0);
}
void main()
{
char str[100];
int ch;
long ii;
int indic, found;
NODE *p;
printf("\e[2J");
printf("\e[1m\e[33m");
menu();
start = gnode();
end = start;
while(1){
scanf("%s",str);
if (str[0] == '.')
switch (toupper(str[1])){
case 'L': loadlist(); break;
case 'F': finddata(); break;
case 'Q': bye();
default : printf("\nWrong command use L, F or Q\n");
}
}
}
|
a.cc: In function 'NODE* gnode()':
a.cc:27:19: error: invalid conversion from 'void*' to 'NODE*' {aka 'node*'} [-fpermissive]
27 | p = malloc(sizeof(NODE));
| ~~~~~~^~~~~~~~~~~~~~
| |
| void*
a.cc: At global scope:
a.cc:72:1: error: '::main' must return 'int'
72 | void main()
| ^~~~
|
s314401370
|
p04047
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>
#include <set>
using namespace std;
double temp(int t, int x){
return t - (x*0.006);
}
int main(void){
int n;
cin >> n;
vector<int> arr(n);
for(int i=0;i<n;i++){
cin >> arr[i];
}
sort(arr.begin(), arr.end());
int sum = 0;
for(int i=0;i<arr.size();i=i+2){
sum += min(arr[i], arr[i+1])
}
cout << sum << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:32:45: error: expected ';' before '}' token
32 | sum += min(arr[i], arr[i+1])
| ^
| ;
33 | }
| ~
|
s270803794
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
void swap(int *x, int *y)
{
int work; /* 作業用 */
work = *x; /* xの値を一時保存 */
*x = *y; /* xの値をyの値に書き換える */
*y = work; /* yの値をxの値に書き換える */
}
void bubbleSort(int arr[], int n) {
int i, j;
for (i = 0; i < n-1; i++){
for (j = 0; j < n-i-1; j++) {
if(arr[j] > arr[j+1]){
swap(&arr[j], arr[j+1]);
}
}
}
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:17:20: error: no matching function for call to 'swap(int*, int&)'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77,
from a.cc:1:
/usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match)
430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); }
| ^~~~
/usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed:
a.cc:17:37: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any'
17 | swap(&arr[j], arr[j+1]);
| ~~~~~~~^
/usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = int&; _VTp = int; _Mgr = _Manager_internal<int>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]'
191 | any(_Tp&& __value)
| ^~~
a.cc:4:7: note: candidate: 'void swap(int*, int*)' (near match)
4 | void swap(int *x, int *y)
| ^~~~
a.cc:4:7: note: conversion of argument 2 would be ill-formed:
a.cc:17:37: error: invalid conversion from 'int' to 'int*' [-fpermissive]
17 | swap(&arr[j], arr[j+1]);
| ~~~~~~~^
| |
| int
In file included from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/stdexcept:38,
from /usr/include/c++/14/system_error:43,
from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'int*' to 'std::__exception_ptr::exception_ptr&'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/future:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)'
328 | swap(thread& __x, thread& __y) noexcept
| ^~~~
/usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'int*' to 'std::thread&'
328 | swap(thread& __x, thread& __y) noexcept
| ~~~~~~~~^~~
In file included from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)'
1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)'
1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)'
1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)'
1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)'
896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
| ^~~~
/usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)'
2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)'
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: deduced conflicting types for parameter '_Tp' ('int*' and 'int')
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
| ^~~~
/usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types '_Tp [_Nm]' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::pair<_T1, _T2>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::pair<_T1, _T2>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed:
a.cc:17:20: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int*'
17 | swap(&arr[j], arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~
I
|
s020501436
|
p04047
|
C++
|
void bubbleSort(int arr[], int n) {
int i, j, temp;
for (i = 0; i < n-1; i++){
for (j = 0; j < n-i-1; j++) {
if(arr[j] > arr[j+1]){
temp = arr[j];
*arr[j] = *arr[j - 1];
arr[j - 1] = temp;
}
}
}
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[], int n) {
int i, j, temp;
for (i = 0; i < n-1; i++){
for (j = 0; j < n-i-1; j++) {
if(arr[j] > arr[j+1]){
temp = arr[j];
arr[j] = arr[j - 1];
arr[j - 1]= temp;
}
}
}
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
提出情報
|
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:7:16: error: invalid type argument of unary '*' (have 'int')
7 | *arr[j] = *arr[j - 1];
| ^~~~~~~
a.cc:7:26: error: invalid type argument of unary '*' (have 'int')
7 | *arr[j] = *arr[j - 1];
| ^~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:16:5: error: 'cin' was not declared in this scope
16 | cin >> N;
| ^~~
a.cc:26:5: error: 'cout' was not declared in this scope
26 | cout << ans << endl;
| ^~~~
a.cc:26:20: error: 'endl' was not declared in this scope
26 | cout << ans << endl;
| ^~~~
a.cc: At global scope:
a.cc:32:6: error: redefinition of 'void bubbleSort(int*, int)'
32 | void bubbleSort(int arr[], int n) {
| ^~~~~~~~~~
a.cc:1:6: note: 'void bubbleSort(int*, int)' previously defined here
1 | void bubbleSort(int arr[], int n) {
| ^~~~~~~~~~
a.cc:45:5: error: redefinition of 'int main()'
45 | int main(){
| ^~~~
a.cc:14:5: note: 'int main()' previously defined here
14 | int main(){
| ^~~~
a.cc:60:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
60 | 提出情報
| ^~~~~~~~
|
s004831605
|
p04047
|
C++
|
void bubbleSort(int arr[], int n) {
int i, j, temp;
for (i = 0; i < n-1; i++){
for (j = 0; j < n-i-1; j++) {
if(arr[j] > arr[j+1]){
temp = *arr[j];
*arr[j] = *arr[j - 1];
*arr[j - 1] = temp;
}
}
}
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[], int n) {
int i, j, temp;
for (i = 0; i < n-1; i++){
for (j = 0; j < n-i-1; j++) {
if(arr[j] > arr[j+1]){
temp = arr[j];
arr[j] = arr[j - 1];
arr[j - 1]= temp;
}
}
}
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
提出情報
|
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:6:23: error: invalid type argument of unary '*' (have 'int')
6 | temp = *arr[j];
| ^~~~~~~
a.cc:7:16: error: invalid type argument of unary '*' (have 'int')
7 | *arr[j] = *arr[j - 1];
| ^~~~~~~
a.cc:7:26: error: invalid type argument of unary '*' (have 'int')
7 | *arr[j] = *arr[j - 1];
| ^~~~~~~~~~~
a.cc:8:16: error: invalid type argument of unary '*' (have 'int')
8 | *arr[j - 1] = temp;
| ^~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:16:5: error: 'cin' was not declared in this scope
16 | cin >> N;
| ^~~
a.cc:26:5: error: 'cout' was not declared in this scope
26 | cout << ans << endl;
| ^~~~
a.cc:26:20: error: 'endl' was not declared in this scope
26 | cout << ans << endl;
| ^~~~
a.cc: At global scope:
a.cc:32:6: error: redefinition of 'void bubbleSort(int*, int)'
32 | void bubbleSort(int arr[], int n) {
| ^~~~~~~~~~
a.cc:1:6: note: 'void bubbleSort(int*, int)' previously defined here
1 | void bubbleSort(int arr[], int n) {
| ^~~~~~~~~~
a.cc:45:5: error: redefinition of 'int main()'
45 | int main(){
| ^~~~
a.cc:14:5: note: 'int main()' previously defined here
14 | int main(){
| ^~~~
a.cc:60:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
60 | 提出情報
| ^~~~~~~~
|
s741488694
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[], int n) {
int i, j, temp;
for (i = 0; i < n-1; i++){
for (j = 0; j < n-i-1; j++) {
if(arr[j] > arr[j+1]){
temp = x[j];
x[j] = x[j - 1];
x[j - 1]= temp;
}
}
}
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:9:23: error: 'x' was not declared in this scope
9 | temp = x[j];
| ^
|
s112230989
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
// Last i elements are already in place
for (j = 0; j < n-i-1; j++)
if (arr[j] > arr[j+1])
swap(&arr[j], &arr[j+1]);
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:12:19: error: no matching function for call to 'swap(int*, int*)'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int*; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match)
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed:
a.cc:12:29: error: cannot bind non-const lvalue reference of type 'int*&' to an rvalue of type 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77:
/usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match)
430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); }
| ^~~~
/usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed:
a.cc:12:29: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any'
12 | swap(&arr[j], &arr[j+1]);
| ^~~~~~~~~
/usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = int*; _VTp = int*; _Mgr = _Manager_internal<int*>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]'
191 | any(_Tp&& __value)
| ^~~
In file included from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/stdexcept:38,
from /usr/include/c++/14/system_error:43,
from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'int*' to 'std::__exception_ptr::exception_ptr&'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/future:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)'
328 | swap(thread& __x, thread& __y) noexcept
| ^~~~
/usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'int*' to 'std::thread&'
328 | swap(thread& __x, thread& __y) noexcept
| ~~~~~~~~^~~
In file included from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)'
1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)'
1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)'
1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)'
1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)'
896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
| ^~~~
/usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)'
2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
| ^~~~
/usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types '_Tp [_Nm]' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::pair<_T1, _T2>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::pair<_T1, _T2>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+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:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>
|
s007991462
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
// Last i elements are already in place
for (j = 0; j < n-i-1; j++)
if (arr[j] > arr[j+1])
swap(&arr[j], &arr[j+1]);
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:12:19: error: no matching function for call to 'swap(int*, int*)'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int*; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match)
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed:
a.cc:12:29: error: cannot bind non-const lvalue reference of type 'int*&' to an rvalue of type 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77:
/usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match)
430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); }
| ^~~~
/usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed:
a.cc:12:29: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any'
12 | swap(&arr[j], &arr[j+1]);
| ^~~~~~~~~
/usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = int*; _VTp = int*; _Mgr = _Manager_internal<int*>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]'
191 | any(_Tp&& __value)
| ^~~
In file included from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/stdexcept:38,
from /usr/include/c++/14/system_error:43,
from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'int*' to 'std::__exception_ptr::exception_ptr&'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/future:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)'
328 | swap(thread& __x, thread& __y) noexcept
| ^~~~
/usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'int*' to 'std::thread&'
328 | swap(thread& __x, thread& __y) noexcept
| ~~~~~~~~^~~
In file included from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)'
1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)'
1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)'
1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)'
1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)'
896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
| ^~~~
/usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)'
2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
| ^~~~
/usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types '_Tp [_Nm]' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::pair<_T1, _T2>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::pair<_T1, _T2>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+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:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>
|
s278164081
|
p04047
|
C++
|
#include <iostream>
using namespace std;
void bubbleSort(int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
// Last i elements are already in place
for (j = 0; j < n-i-1; j++)
if (arr[j] > arr[j+1])
swap(&arr[j], &arr[j+1]);
}
int main(){
int N, L[101];
cin >> N;
for(int i = 0; i < 2 * N; i++){
cin >> L[i];
}
bubbleSort(L, 2 * N);
int ans = 0;
for(int i = 0; i < N; i++){
if(L[2 * i] <= L[2 * i + 1]) ans += L[2 * i];
else ans += L[2 * i + 1];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:12:19: error: no matching function for call to 'swap(int*, int*)'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int*; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match)
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed:
a.cc:12:29: error: cannot bind non-const lvalue reference of type 'int*&' to an rvalue of type 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ^~~~~~~~~
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'int*' to 'std::__exception_ptr::exception_ptr&'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
| ^~~~
/usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types '_Tp [_Nm]' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
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:
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::pair<_T1, _T2>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::pair<_T1, _T2>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int*'
12 | swap(&arr[j], &arr[j+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:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)'
2805 | swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
| ^~~~
/usr/include/c++/14/tuple:2805:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::tuple<_UTypes ...>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2823:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' (deleted)
2823 | swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
| ^~~~
/usr/include/c++/14/tuple:2823:5: note: template argument deduction/substitution failed:
a.cc:12:19: note: mismatched types 'std::tuple<_UTypes ...>' and 'int*'
12 | swap(&arr[j], &arr[j+1]);
| ~~~~^~~~~~~~~~~~~~~~~~~~
|
s117447010
|
p04047
|
Java
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> l(n * 2);
for(int i = 0; i < n * 2; i++){
cin >> l[i];
}
sort(l.begin(), l.end());
int ans = 0;
for(int i = n * 2 - 2; i >= 0; i -= 2)
ans += l[i];
cout << ans << endl;
}
|
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
^
Main.java:5: error: not a statement
cin >> n;
^
Main.java:6: error: not a statement
vector<int> l(n * 2);
^
Main.java:8: error: not a statement
cin >> l[i];
^
Main.java:14: error: not a statement
cout << ans << endl;
^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
int main(){
^
(use --enable-preview to enable unnamed classes)
Main.java:6: error: ';' expected
vector<int> l(n * 2);
^
Main.java:6: error: ';' expected
vector<int> l(n * 2);
^
9 errors
|
s524420490
|
p04047
|
C++
|
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define LL long long
#define int LL
#define P pair<int, int>
const LL N = 2e3 + 10;
const LL mod = 1e9 + 7;
const LL inf = 0x3f3f3f3f;
using namespace std;
template <typename tp>
inline void read(tp &x)
{
x = 0;char c = getchar();bool f = 0;
for (; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
if (f) x = -x;
}
LL n, x, ans;
LL Gcd(LL x, LL n)
{
if (n % x == 0)
return n * 2 - x;
ans = n / x * x * 2 + Gcd(n % x, x);
return ans;
}
int main()
{
read(n),read(x);
printf("%lld\n",Gcd(x, n - x) + n);
return 0;
}
|
cc1plus: error: '::main' must return 'int'
|
s524833323
|
p04047
|
C++
|
#include<iostream>
using namespace std;
int main()
{
int n, arr[101];cin>>n;
assert(n%2==0);
for(int i=1;i<=n;i++) cin>>arr[i];
sort(arr+1, arr+n+1);
int ans=0;
for(int i=1;i<=n;i+=2)
{
ans+=arr[i];
}
cout<<ans;
}
|
a.cc: In function 'int main()':
a.cc:6:9: error: 'assert' was not declared in this scope
6 | assert(n%2==0);
| ^~~~~~
a.cc:2:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
1 | #include<iostream>
+++ |+#include <cassert>
2 | using namespace std;
a.cc:8:9: error: 'sort' was not declared in this scope; did you mean 'short'?
8 | sort(arr+1, arr+n+1);
| ^~~~
| short
|
s936931126
|
p04047
|
C++
|
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
int n,ans=0;
cin >> n;
vec(a,n);
REP(i,n){
cin >> a[i];
}
sort(a.begin(),a,end());
REP(i,n){
if(i%2 == 0){
ans += a[i];
}
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:29: error: no matching function for call to 'end()'
15 | sort(a.begin(),a,end());
| ~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
from /usr/include/c++/14/bits/stl_algo.h:59,
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/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
1249 | end(valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/valarray:1249:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
1265 | end(const valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/valarray:1265:5: note: candidate expects 1 argument, 0 provided
|
s390928573
|
p04047
|
C++
|
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n*2;i++){
cin>>a.at(i);
}
a.sort(a.begin(),a.end());
int c=0;
for(int i=0;i<n;i++){
c+=a.at(i*2);
}
cout<<c<<endl;
}
|
a.cc: In function 'int main()':
a.cc:11:5: error: 'class std::vector<int>' has no member named 'sort'
11 | a.sort(a.begin(),a.end());
| ^~~~
|
s715185406
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n*2;i++){
cin>>a.at(i);
}
a.sort(a.begin(),a.end());
int c=0;
for(int i=0;i<n;i++){
c+=a.at(i*2);
}
cout<<c<<endl;
}
|
a.cc: In function 'int main()':
a.cc:10:5: error: 'class std::vector<int>' has no member named 'sort'
10 | a.sort(a.begin(),a.end());
| ^~~~
|
s157065109
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n*2;i++){
cin>>a.at(i);
}
a.sort(a.begin(),a.end());
int c=0;
for(int i=0;i<n;i++){
c+=a.at(i*2);
}
cout<<c<<end;
}
|
a.cc: In function 'int main()':
a.cc:10:5: error: 'class std::vector<int>' has no member named 'sort'
10 | a.sort(a.begin(),a.end());
| ^~~~
a.cc:15:10: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
15 | cout<<c<<end;
| ~~~~~~~^~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::
|
s832262688
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n*2;i++){
cin>>a.at(i);
}
a.sort();
int c=0;
for(int i=0;i<n;i++){
c+=a.at(i*2);
}
cout<<c<<end;
}
|
a.cc: In function 'int main()':
a.cc:10:5: error: 'class std::vector<int>' has no member named 'sort'
10 | a.sort();
| ^~~~
a.cc:15:10: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
15 | cout<<c<<end;
| ~~~~~~~^~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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>
|
s447690484
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n*2;i++){
cin>>a.at(i);
}
a.sort(a.begin(),a.end());
int c=0;
for(int i=0;i<n;i++){
c+=a.at(i*2);
}
cout<<c<<end;
}
|
a.cc: In function 'int main()':
a.cc:10:5: error: 'class std::vector<int>' has no member named 'sort'
10 | a.sort(a.begin(),a.end());
| ^~~~
a.cc:15:10: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
15 | cout<<c<<end;
| ~~~~~~~^~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
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::
|
s875270987
|
p04047
|
C++
|
#include <bits/stdc++.h>
#define For(i, j, k) for (int i = j; i <= k; ++ i)
#define Forr(i, j, k) for (int i = j; i >= k; -- i)
using namespace std;
inline int read() {
int x = 0, p = 1; char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') p = -1;
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
return x * p;
}
inline void File() {
freopen("D.in", "r", stdin);
freopen("D.out", "w", stdout);
}
const int N = 1e2 + 10;
int a[N], sta[N], tp, n, m, lst, sum, cnt, ans[N];
int main() {
n = read(), m = read();
For(i, 1, m) {
a[i] = read();
if (a[i] & 1) sta[++ tp] = i;
}
if (tp > 2) return puts("Impossible"), 0;
if (tp > 0) swap(a[1], a[sta[1]]);
if (tp > 1) swap(a[m], a[sta[2]]);
// For(i, 1, m) cout << a[i] << ' '; cout << endl;
if (m == 1) return printf("%d\n2\n%d %d", a[1], a[1] - 1, 1), 0;
For(i, 1, m) printf("%d ", a[i]); puts("");
ans[++ cnt] = lst = a[1] - 1; sum = 1;
For(i, 1, m) sum += a[i], ans[++ cnt] = sum - lst, lst = sum;
ans[cnt] -= 1;
iNt tt = 0; For(i, 1, cnt) if (ans[i] == 0) ++ tt;
printf("%d\n", cnt - tt);
For(i, 1, cnt) if (ans[i]) printf("%d ", ans[i]); puts("");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:46:9: error: 'iNt' was not declared in this scope; did you mean 'int'?
46 | iNt tt = 0; For(i, 1, cnt) if (ans[i] == 0) ++ tt;
| ^~~
| int
a.cc:46:56: error: 'tt' was not declared in this scope; did you mean 'tp'?
46 | iNt tt = 0; For(i, 1, cnt) if (ans[i] == 0) ++ tt;
| ^~
| tp
a.cc:48:30: error: 'tt' was not declared in this scope; did you mean 'tp'?
48 | printf("%d\n", cnt - tt);
| ^~
| tp
|
s670314463
|
p04047
|
C++
|
#include <cstdio>
#include <algorithm>
#define rg register int
#define rep(a, b, c) for(rg a=b; a<=c; ++a)
int a[102];
inline int read() {
int x=0; char ch=getchar();
while(ch<'0'||ch>'9') ch=getchar();
while(ch>='0'&&ch<='9') {
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return x;
}
int main() {
int n; n=read();
int ans=0;
rep(i, 1, n) a[i]=read();
std::sort(a+1, a+i+1);
for(rg i=1; i<=2*n; i+=2) ans+=a[i];
printf("%d", ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:21:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
21 | rep(i, 1, n) a[i]=read();
| ^
a.cc:4:29: note: in definition of macro 'rep'
4 | #define rep(a, b, c) for(rg a=b; a<=c; ++a)
| ^
a.cc:22:22: error: 'i' was not declared in this scope
22 | std::sort(a+1, a+i+1);
| ^
a.cc:23:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
23 | for(rg i=1; i<=2*n; i+=2) ans+=a[i];
| ^
|
s920841754
|
p04047
|
C++
|
#include "pch.h"
#include <iostream>
#include<algorithm>
using namespace std;
int n[1919];
int main()
{
int a;
int iwa = 0;
cin >> a;
int b = a * 2;
for (int i = 0; i < b; i++) {
cin >> n[i];
}
sort(n, n + b);
for (int i = 0; i < b; i += 2) {
iwa += n[i];
}
cout << iwa << endl;
}
|
a.cc:1:10: fatal error: pch.h: No such file or directory
1 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s596174777
|
p04047
|
C++
|
#include <iostream>
using namespace std;
int n,l[200],a;
int main(){
cin>>n;
for(int i=0;i<n*2;i++)cin>>l[i];
sort(l,l+n*2);
for(int i=0;i<n;i++)a+=l[i*2];
cout<<a<<endl;
}
|
a.cc: In function 'int main()':
a.cc:7:3: error: 'sort' was not declared in this scope; did you mean 'short'?
7 | sort(l,l+n*2);
| ^~~~
| short
|
s718058710
|
p04047
|
C++
|
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n; cin >> n;
vector<int> L(2 * n);
for(int i = 0; i < 2 * n; i++) cin >> L[i];
sort(L.begin(), L.end());
int ans = 0;
for(int i = 0; i < 2 * n; i++) ans += L[2 * i];
cout << ans;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
7 | vector<int> L(2 * n);
| ^~~~~~
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 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
7 | vector<int> L(2 * n);
| ^~~
a.cc:8:41: error: 'L' was not declared in this scope
8 | for(int i = 0; i < 2 * n; i++) cin >> L[i];
| ^
a.cc:9:8: error: 'L' was not declared in this scope
9 | sort(L.begin(), L.end());
| ^
|
s111413063
|
p04047
|
C++
|
#include <iosiream>
#include <algorithm>
using namespace std;
int main(){
int n; cin >> n;
vector<int> L(2 * n);
for(int i = 0; i < 2 * n; i++) cin >> L[i];
sort(L.begin(), L.end());
int ans = 0;
for(int i = 0; i < 2 * n; i++) ans += L[2 * i];
cout << ans;
return 0;
}
|
a.cc:1:10: fatal error: iosiream: No such file or directory
1 | #include <iosiream>
| ^~~~~~~~~~
compilation terminated.
|
s701215518
|
p04047
|
C++
|
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;
template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);
signed main(){
int n;
cin >> n
vec L(n);
readvec(L);
SORT(L);
int ans = 0:
REP(i, n)a{
ans += L[2 * i];
}
cout << ans;
return 0;
}
template<typename T>
void readvec(vector<T> &a){
REP(i, a.size()){
cin >> a[i];
}
}
void readindex(vector<int> &a){
REP(i, a.size()){
cin >> a[i];
a[i]--;
}
}
|
a.cc:1: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
1 | <U+202A>#include <bits/stdc++.h><U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:1:1: error: stray '#' in program
1 | #include <bits/stdc++.h>
| ^
a.cc:12:5: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
12 | <U+202A>using namespace std;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:14:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
14 | <U+202A>typedef vector<int> vec;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:15:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
15 | <U+202A>typedef vector<vec> mat;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:16:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
16 | <U+202A>typedef pair<int, int> Pii;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:18:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
18 | <U+202A>template<typename T><U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:19:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
19 | <U+202A>void readvec(vector<T> &a);<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:20:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
20 | <U+202A>void readindex(vector<int> &a);<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:24:6: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
24 | <U+202A>signed main(){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:26: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
26 | <U+202A> <U+202C>int n;
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:37: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
37 | <U+202A> return 0;<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:38: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
38 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:41:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
41 | <U+202A>template<typename T><U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:42:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
42 | <U+202A>void readvec(vector<T> &a){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
43 | <U+202A> REP(i, a.size()){<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:44: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
44 | <U+202A> cin >> a[i];<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:45: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
45 | <U+202A> }<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:46: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
46 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:47:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
47 | <U+202A>void readindex(vector<int> &a){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:48: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
48 | <U+202A> REP(i, a.size()){<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:49: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
49 | <U+202A> cin >> a[i];<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:50: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
50 | <U+202A> a[i]--;<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:51: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
51 | <U+202A> }<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:52: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
52 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:1:1: error: '\U0000202a' does not name a type
1 | #include <bits/stdc++.h>
|
a.cc:12:21: error: '\U0000202c' does not name a type
12 | using namespace std;
|
a.cc:14:25: error: '\U0000202c' does not name a type
14 | typedef vector<int> vec;
|
a.cc:15:25: error: '\U0000202c' does not name a type
15 | typedef vector<vec> mat;
|
a.cc:16:28: error: '\U0000202c' does not name a type
16 | typedef pair<int, int> Pii;
|
a.cc:19:28: error: '\U0000202c' does not name a type
19 | void readvec(vector<T> &a);
|
a.cc:20:32: error: '\U0000202c' does not name a type
20 | void readindex(vector<int> &a);
|
a.cc:38:2: error: '\U0000202c' does not name a type
38 | }
|
a.cc:46:2: error: '\U0000202c' does not name a type
46 | }
|
a.cc:52:2: error: '\U0000202c' does not name a type
52 | }
|
|
s424818303
|
p04047
|
C++
|
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;
template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);
signed main(){
int n;
cin >> n
vec L(n);
readvec(L);
SORT(L);
int ans = 0:
REP(i, n){
ans += L[2 * i + 1];
}
cout << ans;
return 0;
}
template<typename T>
void readvec(vector<T> &a){
REP(i, a.size()){
cin >> a[i];
}
}
void readindex(vector<int> &a){
REP(i, a.size()){
cin >> a[i];
a[i]--;
}
}
|
a.cc:1: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
1 | <U+202A>#include <bits/stdc++.h><U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:1:1: error: stray '#' in program
1 | #include <bits/stdc++.h>
| ^
a.cc:6: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | <U+202A>#define SORT(a) sort(a.begin(), a.end())<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:6:1: error: stray '#' in program
6 | #define SORT(a) sort(a.begin(), a.end())
| ^
a.cc:12:5: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
12 | <U+202A>using namespace std;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:14:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
14 | <U+202A>typedef vector<int> vec;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:15:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
15 | <U+202A>typedef vector<vec> mat;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:16:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
16 | <U+202A>typedef pair<int, int> Pii;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:18:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
18 | <U+202A>template<typename T><U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:19:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
19 | <U+202A>void readvec(vector<T> &a);<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:20:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
20 | <U+202A>void readindex(vector<int> &a);<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:24:6: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
24 | <U+202A>signed main(){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:26: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
26 | <U+202A> <U+202C>int n;
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:37: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
37 | <U+202A> return 0;<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:38: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
38 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:41:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
41 | <U+202A>template<typename T><U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:42:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
42 | <U+202A>void readvec(vector<T> &a){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
43 | <U+202A> REP(i, a.size()){<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:44: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
44 | <U+202A> cin >> a[i];<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:45: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
45 | <U+202A> }<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:46: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
46 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:47:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
47 | <U+202A>void readindex(vector<int> &a){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:48: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
48 | <U+202A> REP(i, a.size()){<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:49: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
49 | <U+202A> cin >> a[i];<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:50: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
50 | <U+202A> a[i]--;<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:51: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
51 | <U+202A> }<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:52: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
52 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:1:1: error: '\U0000202a' does not name a type
1 | #include <bits/stdc++.h>
|
a.cc:12:21: error: '\U0000202c' does not name a type
12 | using namespace std;
|
a.cc:14:25: error: '\U0000202c' does not name a type
14 | typedef vector<int> vec;
|
a.cc:15:25: error: '\U0000202c' does not name a type
15 | typedef vector<vec> mat;
|
a.cc:16:28: error: '\U0000202c' does not name a type
16 | typedef pair<int, int> Pii;
|
a.cc:19:28: error: '\U0000202c' does not name a type
19 | void readvec(vector<T> &a);
|
a.cc:20:32: error: '\U0000202c' does not name a type
20 | void readindex(vector<int> &a);
|
a.cc:38:2: error: '\U0000202c' does not name a type
38 | }
|
a.cc:46:2: error: '\U0000202c' does not name a type
46 | }
|
a.cc:52:2: error: '\U0000202c' does not name a type
52 | }
|
|
s076913872
|
p04047
|
C++
|
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;
template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);
signed main(){
int n;
cin >> n
vec L(n);
readvec(L);
SORT(L);
int ans = 0:
REP(i, n){
ans += L[2 * i + 1];
}
cout << ans;
return 0;
}
template<typename T>
void readvec(vector<T> &a){
REP(i, a.size()){
cin >> a[i];
}
}
void readindex(vector<int> &a){
REP(i, a.size()){
cin >> a[i];
a[i]--;
}
}
|
a.cc:1: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
1 | <U+202A>#include <bits/stdc++.h><U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:1:1: error: stray '#' in program
1 | #include <bits/stdc++.h>
| ^
a.cc:2: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
2 | <U+202A>#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:2:1: error: stray '#' in program
2 | #define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
| ^
a.cc:3: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
3 | <U+202A>#define REP(i, n) FOR(i,0,n)<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:3:1: error: stray '#' in program
3 | #define REP(i, n) FOR(i,0,n)
| ^
a.cc:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
4 | <U+202A>#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:4:1: error: stray '#' in program
4 | #define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
| ^
a.cc:5: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
5 | <U+202A>#define IREP(i, n) IFOR(i,0,n)<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:5:1: error: stray '#' in program
5 | #define IREP(i, n) IFOR(i,0,n)
| ^
a.cc:6: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | <U+202A>#define SORT(a) sort(a.begin(), a.end())<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:6:1: error: stray '#' in program
6 | #define SORT(a) sort(a.begin(), a.end())
| ^
a.cc:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
7 | <U+202A>#define REVERSE(a) reverse(a.begin(), a.end())<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:7:1: error: stray '#' in program
7 | #define REVERSE(a) reverse(a.begin(), a.end())
| ^
a.cc:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
8 | <U+202A>#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:8:1: error: stray '#' in program
8 | #define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
| ^
a.cc:9: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | <U+202A>#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:9:1: error: stray '#' in program
9 | #define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
| ^
a.cc:10: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
10 | <U+202A>#define int long long<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:10:1: error: stray '#' in program
10 | #define int long long
| ^
a.cc:11: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
11 | <U+202A>#define INF 1000000000000000000<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:11:1: error: stray '#' in program
11 | #define INF 1000000000000000000
| ^
a.cc:12:5: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
12 | <U+202A>using namespace std;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:14:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
14 | <U+202A>typedef vector<int> vec;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:15:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
15 | <U+202A>typedef vector<vec> mat;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:16:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
16 | <U+202A>typedef pair<int, int> Pii;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:18:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
18 | <U+202A>template<typename T><U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:19:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
19 | <U+202A>void readvec(vector<T> &a);<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:20:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
20 | <U+202A>void readindex(vector<int> &a);<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:24:6: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
24 | <U+202A>signed main(){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:26: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
26 | <U+202A> <U+202C>int n;
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:37: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
37 | <U+202A> return 0;<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:38: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
38 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:41:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
41 | <U+202A>template<typename T><U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:42:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
42 | <U+202A>void readvec(vector<T> &a){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
43 | <U+202A> REP(i, a.size()){<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:44: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
44 | <U+202A> cin >> a[i];<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:45: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
45 | <U+202A> }<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:46: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
46 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:47:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
47 | <U+202A>void readindex(vector<int> &a){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:48: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
48 | <U+202A> REP(i, a.size()){<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:49: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
49 | <U+202A> cin >> a[i];<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:50: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
50 | <U+202A> a[i]--;<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:51: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
51 | <U+202A> }<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:52: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
52 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
|
s109751545
|
p04047
|
C++
|
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;
template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);
signed main(){
int n;
cin >> n
vec L(n);
readvec(L);
SORT(L);
int ans = 0:
REP(i, n){
ans += L[2 * i + 1];
}
cour << ans;
return 0;
}
template<typename T>
void readvec(vector<T> &a){
REP(i, a.size()){
cin >> a[i];
}
}
void readindex(vector<int> &a){
REP(i, a.size()){
cin >> a[i];
a[i]--;
}
}
|
a.cc:1: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
1 | <U+202A>#include <bits/stdc++.h><U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:1:1: error: stray '#' in program
1 | #include <bits/stdc++.h>
| ^
a.cc:2: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
2 | <U+202A>#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:2:1: error: stray '#' in program
2 | #define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
| ^
a.cc:3: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
3 | <U+202A>#define REP(i, n) FOR(i,0,n)<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:3:1: error: stray '#' in program
3 | #define REP(i, n) FOR(i,0,n)
| ^
a.cc:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
4 | <U+202A>#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:4:1: error: stray '#' in program
4 | #define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
| ^
a.cc:5: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
5 | <U+202A>#define IREP(i, n) IFOR(i,0,n)<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:5:1: error: stray '#' in program
5 | #define IREP(i, n) IFOR(i,0,n)
| ^
a.cc:6: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | <U+202A>#define SORT(a) sort(a.begin(), a.end())<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:6:1: error: stray '#' in program
6 | #define SORT(a) sort(a.begin(), a.end())
| ^
a.cc:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
7 | <U+202A>#define REVERSE(a) reverse(a.begin(), a.end())<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:7:1: error: stray '#' in program
7 | #define REVERSE(a) reverse(a.begin(), a.end())
| ^
a.cc:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
8 | <U+202A>#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:8:1: error: stray '#' in program
8 | #define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
| ^
a.cc:9: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | <U+202A>#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:9:1: error: stray '#' in program
9 | #define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
| ^
a.cc:10: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
10 | <U+202A>#define int long long<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:10:1: error: stray '#' in program
10 | #define int long long
| ^
a.cc:11: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
11 | <U+202A>#define INF 1000000000000000000<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:11:1: error: stray '#' in program
11 | #define INF 1000000000000000000
| ^
a.cc:12:5: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
12 | <U+202A>using namespace std;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:14:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
14 | <U+202A>typedef vector<int> vec;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:15:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
15 | <U+202A>typedef vector<vec> mat;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:16:7: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
16 | <U+202A>typedef pair<int, int> Pii;<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:18:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
18 | <U+202A>template<typename T><U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:19:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
19 | <U+202A>void readvec(vector<T> &a);<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:20:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
20 | <U+202A>void readindex(vector<int> &a);<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:24:6: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
24 | <U+202A>signed main(){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:26: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
26 | <U+202A> <U+202C>int n;
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:37: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
37 | <U+202A> return 0;<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:38: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
38 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:41:8: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
41 | <U+202A>template<typename T><U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:42:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
42 | <U+202A>void readvec(vector<T> &a){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
43 | <U+202A> REP(i, a.size()){<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:44: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
44 | <U+202A> cin >> a[i];<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:45: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
45 | <U+202A> }<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:46: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
46 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:47:4: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
47 | <U+202A>void readindex(vector<int> &a){<U+202C>
| ~~~~~~~~ ^
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:48: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
48 | <U+202A> REP(i, a.size()){<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:49: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
49 | <U+202A> cin >> a[i];<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:50: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
50 | <U+202A> a[i]--;<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:51: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
51 | <U+202A> }<U+202C>
| ~~~~~~~~
| | |
| | end of bidirectional context
| U+202A (LEFT-TO-RIGHT EMBEDDING)
a.cc:52: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
52 | <U+202A>}<U+202C>
| ~~~~~~~~
| | |
|
s895038131
|
p04047
|
C++
|
#include<stdio.h>
int n,a[100010],s=0;
int main()
{
scanf("%d",&n);
for(int i=1;i<=2*n;i++)
scanf("%d",&a[i]);
sort(a+1,a+1+2*n);
for(int i=1;i<=2*n;i+=2)
s+=a[i];
printf("%d\n",s);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:5: error: 'sort' was not declared in this scope; did you mean 'short'?
8 | sort(a+1,a+1+2*n);
| ^~~~
| short
|
s693541483
|
p04047
|
C
|
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[210];
int main()
{
cin>>n;
for(int i=1;i<=2*n;++i){
scanf("%d",a+i);
}
sort(a+1,a+2*n+1);
int ans=0;
for(int i=1;i<=2*n;i+=2){
ans+=a[i];
}
cout<<ans<<endl;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s064280594
|
p04047
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char** argv) {
int n, li;
vector<int> l;
cin >> n;
for (size_t i = 0; i < n * 2; i++) {
cin >> li;
l.push_back(li);
}
sort(l.begin(), l.end());
int s = 0;
for (int i = 0; i < n; i += 2) {
s += l[i];
}
cout << l;
return 0;
}
|
a.cc: In function 'int main(int, char**)':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(l.begin(), l.end());
| ^~~~
| short
a.cc:17:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>')
17 | cout << l;
| ~~~~ ^~ ~
| | |
| | std::vector<int>
| std::ostream {aka std::basic_ostream<char>}
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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
| ^~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:124:5: note: candidate: 'std::basic_ostream<_CharT, _Tr
|
s656177839
|
p04047
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int ans=0,n,array[200];
cin>>n;
for(int i=0;i<2n;i++){
cin>>array[i];
}
sort(array,array+2n);
for(int i=0;i<2n;i+=2){
ans+=array[i];
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:7:17: error: unable to find numeric literal operator 'operator""n'
7 | for(int i=0;i<2n;i++){
| ^~
a.cc:10:20: error: unable to find numeric literal operator 'operator""n'
10 | sort(array,array+2n);
| ^~
a.cc:11:17: error: unable to find numeric literal operator 'operator""n'
11 | for(int i=0;i<2n;i+=2){
| ^~
|
s528318762
|
p04047
|
C++
|
#include<iostream>
#include<algorithm>
using namespace std;
int a[10005],ans=0;
int main()
{
cin>>n;
for(int i=1;i<=2*n;i++)
cin>>a[i];
sort(a+1,a+1+2*n);
for(int i=1;i<=2*n;i+=2)
ans+=a[i];
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:10: error: 'n' was not declared in this scope
7 | cin>>n;
| ^
|
s849155897
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int a[10001],ans=0,bns=0,n;
int main(){
scanf("%d",&n);
for(int i=1;i<=2*n;i++)scanf("%d",&a[i]);
sort(a+1,a+1+2*n);
for(int i=1;i<=2*n;i+=2)bns+=a[i];。
printf("%d\n",bns);
return 0;
}
|
a.cc:8:39: error: extended character 。 is not valid in an identifier
8 | for(int i=1;i<=2*n;i+=2)bns+=a[i];。
| ^
a.cc: In function 'int main()':
a.cc:8:39: error: '\U00003002' was not declared in this scope
8 | for(int i=1;i<=2*n;i+=2)bns+=a[i];。
| ^~
|
s523660820
|
p04047
|
C++
|
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int> L(2*N);
for(int i = 0; i < 2*N;i++){
cin >> L.at(i);
}
sort(L.begin(). L.end());
int ans =0;
for(int i = 0; i < N; i++){
ans += L.at(2*i);
}
cout << ans;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:25: error: 'std::vector<int>::iterator' has no member named 'L'
15 | sort(L.begin(). L.end());
| ^
|
s669410350
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,s=0;
int a[200];
cin>>n;
for(int i=0;i<2*n;i++)
cin>>a[i];
sort(a,a+2*n)
for(int i=0;i<2*n;i+=2)
s+=a[i];
cout<<s<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:15: error: expected ';' before 'for'
9 | sort(a,a+2*n)
| ^
| ;
10 | for(int i=0;i<2*n;i+=2)
| ~~~
a.cc:10:14: error: 'i' was not declared in this scope
10 | for(int i=0;i<2*n;i+=2)
| ^
|
s796361835
|
p04047
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int a[10001],ans=0,bns=0,n;
int main(){
scanf("%d",&n);
for(int i=1;i<=2*n;i++){
scanf("%d",&a[i]);
}
sort(a+1,a+1+2*n);
for(int i=1;i<=2*n;i+=2){
bns+=a[i];
}
printf("%d\n",bns);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:5:19: error: expected ';' before '\U0000ff1b'
5 | scanf("%d",&n);
| ^~
| ;
a.cc:6:17: error: 'i' was not declared in this scope
6 | for(int i=1;i<=2*n;i++){
| ^
|
s969668962
|
p04047
|
C++
|
#include<abits/stdc++.h>
using namespace std;
int a[10001],ans=0,bns=0,n;
int main(){
scanf("%d",&n);
for(int i=1;i<=2*n;i++){
scanf("%d",&a[i]);
}
sort(a+1,a+1+2*n);
for(int i=1;i<=2*n;i+=2){
bns+=a[i];
}
printf("%d\n",bns);
return 0;
}
|
a.cc:1:9: fatal error: abits/stdc++.h: No such file or directory
1 | #include<abits/stdc++.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
|
s622890240
|
p04047
|
C++
|
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
int arr[2*n];
for(int i=0; i<2*n; i++)
cin >> arr[i];
sort(arr);
for(int i=0; i<2*n; i++) {
if(i % 2 == 0)
ans += arr[i];
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:12:13: error: no matching function for call to 'sort(int [(n * 2)])'
12 | sort(arr);
| ~~~~^~~~~
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: candidate expects 2 arguments, 1 provided
/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, 1 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, 1 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, 1 provided
|
s235634640
|
p04047
|
C++
|
//
// Physics Simulator
//まだ途中です!!
//
#include <GL/glut.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
void Display(void);
void Reshape(int,int);
void Timer(int);
struct tm *ts; // Pointer to tm structure
double ls;
double cnt=1.0;
int xs, ys; // Second Hand Coordinate
int xm, ym; // Minute Hand Coordinate
int xh , yh; // Second Hand Coordinate
double d,dd=1.57;
double tt;
double t=580.0;
double xc, yc; // Center Coordinate
double xd, yd; // Scale of Panel
double xd0, yd0; // Scale0 of Panel
int ld; // Radius of Panel
int ld0; // Radius of Panel Indicate
double theta; // Angle
int i ; // Loop Counter
int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitWindowSize (300, 300);
glutCreateWindow("Physics Simulator");
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
glutTimerFunc (500, Timer, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glClearColor(0.0, 0.0, 1.0, 0.0);
glutMainLoop();
return(0);
}
//
// Update Window Display
//
void Display(void){
//*******************************************************
//Setting
// Window Title
glutSetWindowTitle("Physics Simulator");
// Bachground Paint
glClearColor(2.0,2.0,2.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
//********************************************************
//等速円運動
ls = 120;
xc = 150;
yc = 150;
// 軌道
glLineWidth(1.5);
glBegin(GL_LINE_STRIP);
for (double d = 0.0 ; d < 360.0 ; d+=0.1){
xd = xc + (ls * sin(d));
yd = yc - (ls * cos(d));
//
glColor3ub (0.0 , 0.0, 0.0);
glVertex2d(xd,yd);
}
glEnd();
//点
xs = xc + (ls * sin(dd));
ys = yc - (ls * cos(dd));
glPointSize(10.0);
glBegin(GL_POINTS);
glColor3ub (0.0, 0.0, 0.0);
glVertex2d(xs , ys);
glEnd();
//*******************************************************
//単振動
xc+=250.0;
//点
glPointSize(10.0);
glBegin(GL_POINTS);
glColor3ub (0.0, 0.0, 0.0);
glVertex2d(xc , ys);
glEnd();
//線
glLineWidth(2.0);
glBegin(GL_LINES);
glColor3ub (0.0, 0.0, 0.0);
glVertex2d(xs,ys);
glVertex2d(xc,ys);
glEnd();
//縦軸
glLineWidth(1.5);
glBegin(GL_LINES);
glColor3ub (0.0, 0.0, 0.0);
glVertex2d(xc,15.0);
glVertex2d(xc,280.0);
glEnd();
//********************************************************
//カーブ
xc += 150.0;
//軌道
tt = 580.0;
glLineWidth(1.5);
glBegin(GL_LINE_LOOP);
for (double d = 1.57 ; d >= -4.71 ; d-=0.01){
yd =yc - 120 * cos(d);
glColor3ub (0.0 , 0.0, 0.0);
glVertex2d(tt,yd);
tt += 0.5;
}
glEnd();
//横軸
glLineWidth(1.5);
glBegin(GL_LINES);
glColor3ub (0.0, 0.0, 0.0);
glVertex2d(xc,150.0);
glVertex2d(xc+400.0,150.0);
glEnd();
//縦軸
glLineWidth(1.5);
glBegin(GL_LINES);
glColor3ub (0.0, 0.0, 0.0);
glVertex2d(xc+30.0,15.0);
glVertex2d(xc+30.0,280.0);
glEnd();
//点
glPointSize(10.0);
glBegin(GL_POINTS);
glColor3ub (0.0, 0.0, 0.0);
glVertex2d(t, ys);
glEnd();
//線
glLineWidth(2.0);
glBegin(GL_LINES);
glColor3ub (0.0, 0.0, 0.0);
glVertex2d(xs,ys);
glVertex2d(t,ys);
glEnd();
//*************************************************************
//数値表示
//*************************************************************
glFlush();
// Finish
usleep(2500);//滑らかな動きを出す
if((int)(dd*100) == -471){
t = 580.0;
dd = 1.57;
}
dd -= 0.01;
t += 0.5;
glutSwapBuffers();
}
// Reset Coordinate if occurs Window Resizing
//
void Reshape(int w, int h){
glViewport(0, 0, w, h);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity();
gluOrtho2D(0 , w, 0, h);
glScaled(1, -1, 1);
glTranslated(0, -h, 0);
glutReshapeWindow(1000 , 300); // Window Size Fixing
}
// Timer Interrupt
void Timer(int value){
glutPostRedisplay();
glutTimerFunc(500, Timer, value);
}
|
a.cc:5:10: fatal error: GL/glut.h: No such file or directory
5 | #include <GL/glut.h>
| ^~~~~~~~~~~
compilation terminated.
|
s072346603
|
p04047
|
C++
|
//
// Analog Clock
//
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
void Display(void);
void Reshape(int,int);
void PrintText(int, int, char *);
void Keyboard(unsigned char, int, int);
void Timer(int);
double Time=90;
int ls, lm, lh; // Length of Needle
int xs, ys; // Second Hand Coordinate
int xm, ym; // Minute Hand Coordinate
int xh , yh; // Second Hand Coordinate
int xc, yc; // Center Coordinate
double xd, yd; // Scale of Panel
int ld; // Radius of Panel
int ld0; // Radius of Panel Indicate
int tmp[360][2];
double theta; // Angle
int i ,count=0; // Loop Counter
double j ;
double tmpx,tmpy;
double maxy=0,miny=1e9;
double disx = 0,tmppy[200];
char wt[20];
double x,v,a;
char xmessage[100];
char vmessage[100];
char amessage[100];
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize (700, 300);
glutCreateWindow("takeuti");
glutDisplayFunc(Display);
glutKeyboardFunc(Keyboard);
glutReshapeFunc(Reshape);
glutTimerFunc (1, Timer, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glClearColor(0.5, 0.0, 1.0, 1.0);
glutMainLoop();
return(0);
}
//
// Update Window Display
//
void Display(void)
{
ls = 129;
lm = 120;
lh = 90;
ld = ls + 10;
ld0 = ls-10;
xc = 150;
yc = 150;
// Getting Current Time
// time(&tt);
// ts = localtime(&tt);
// It's 10:40:20 ,now.
// Window Title
glutSetWindowTitle(wt);
// Bachground Paint
glClear(GL_COLOR_BUFFER_BIT);
// Watch face
// 各点の座標取得
for (i = 0 ; i < 360 ; i++)
{
theta = 2.0 * M_PI * (double)i / 360.0;
xd = xc + (int)(ld * sin(theta));
yd = yc - (int)(ld * cos(theta));
glPointSize (5.0);
tmp[i][0] = xd;
tmp[i][1] = yd;
if(maxy < yd) {
maxy = yd;
}
if(miny > yd) {
miny = yd;
}
}
for(i = 0; i < 200; i++) {
theta = 2.0 * M_PI * (double)i / 200;
yd = yc - (int)(ld * sin(theta));
tmppy[i] = yd;
}
//座標取得終わり
glLineWidth(3.0);
glBegin(GL_LINE_LOOP);
for(i = 0; i < 360; i++) {
glVertex2i(tmp[i][0], tmp[i][1]);
}
glEnd();
glBegin(GL_LINE_STRIP);
for(i = 0; i < 200; i++) {
glVertex2d((double)450+i, tmppy[i]);
}
glEnd();
// 単振動軸
glBegin(GL_LINES);
glVertex2i(340,miny);
glVertex2i(340,maxy);
glEnd();
// 正弦波軸
glBegin(GL_LINES);
glVertex2i(450,150);
glVertex2i(650,150);
glEnd();
glColor3ub (255, 255, 255);
theta = M_PI * (double) Time / 180.0;
double Theta = theta - (M_PI/2);
// 円運動、単振動、正弦波表示
tmpx = xc + (int)(ld * sin(theta));
tmpy= yc - (int)(ld * cos(theta));
glColor3ub (220 , 220, 220);
glPointSize(10.0);
glBegin(GL_POINTS);
glVertex2d(tmpx , tmpy);
glVertex2d(340 ,tmpy);
glVertex2d((double)450 + disx ,tmpy);
glEnd();
glLineWidth(1.5);
glBegin(GL_LINE_STRIP);
glVertex2d(tmpx , tmpy);
glVertex2d(340 ,tmpy);
glVertex2d((double)450 + disx , tmpy);
glEnd();
// 変数教示
printf("x = %.2f : ",(ld * M_PI * sin(Theta)));
printf("v = %.2f : ",(ld * M_PI * cos(Theta)));
printf("a = %.2f\n ",((-1) * ld * M_PI * M_PI * sin(Theta)));
x = (-1) * ld * M_PI * sin(Theta);
v = ld * M_PI * cos(Theta);
a = ld * M_PI * M_PI * sin(Theta);
snprintf(xmessage, 100, "%.2f",x);
snprintf(vmessage, 100, "%.2f",v);
snprintf(amessage, 100, "%.2f", a);
glColor3ub(255, 200, 200);
PrintText(355, 50, "x:");
PrintText(375, 50, xmessage);
PrintText(355, 140, "v:");
PrintText(375, 140, vmessage);
PrintText(355, 230, "a:");
PrintText(375, 230, amessage);
// 変数表示終わり
if(Time == 0) {
Time = 360;
}else{
Time-=0.08;
}
disx += (double)200/4500;
if(disx > 200) {
disx = 0;
}
// Finish
glFlush();
glutSwapBuffers();
}
// Reset Coordinate if occurs Window Resizing
//
void Reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity();
gluOrtho2D(0 , w, 0, h);
glScaled(1, -1, 1);
glTranslated(0, -h, 0);
glutReshapeWindow(700, 300); // Window Size Fixing
}
void PrintText(int x, int y, char *s)
{
int i , l;
glRasterPos2i(x , y);
l = strlen(s);
for (i = 0 ; i < l ; i++)
{
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, s[i]);
}
}
void Keyboard(unsigned char key, int x, int y)
{
if ((key == 'q') || (key == 27))
{
printf("Finished\n");
exit(0);
}
}
// Timer Interrupt
void Timer(int value)
{
glutPostRedisplay();
glutTimerFunc(5.8, Timer, value);
}
|
a.cc:4:10: fatal error: GL/glut.h: No such file or directory
4 | #include <GL/glut.h>
| ^~~~~~~~~~~
compilation terminated.
|
s434503026
|
p04047
|
C++
|
//
// Analog Clock
//
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
void Display(void);
void Reshape(int,int);
void PrintText(int, int, char *);
void Keyboard(unsigned char, int, int);
void Timer(int);
double Time=90;
int ls, lm, lh; // Length of Needle
int xs, ys; // Second Hand Coordinate
int xm, ym; // Minute Hand Coordinate
int xh , yh; // Second Hand Coordinate
int xc, yc; // Center Coordinate
double xd, yd; // Scale of Panel
int ld; // Radius of Panel
int ld0; // Radius of Panel Indicate
int tmp[360][2];
double theta; // Angle
int i ,count=0; // Loop Counter
double j ;
double tmpx,tmpy;
double maxy=0,miny=1e9;
double disx = 0;
char wt[20];
double x,v,a;
char xmessage[100];
char vmessage[100];
char amessage[100];
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize (700, 300);
glutCreateWindow("takeuti");
glutDisplayFunc(Display);
glutKeyboardFunc(Keyboard);
glutReshapeFunc(Reshape);
glutTimerFunc (1, Timer, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glClearColor(0.5, 0.0, 1.0, 1.0);
glutMainLoop();
return(0);
}
//
// Update Window Display
//
void Display(void)
{
ls = 129;
lm = 120;
lh = 90;
ld = ls + 10;
ld0 = ls-10;
xc = 150;
yc = 150;
// Getting Current Time
// time(&tt);
// ts = localtime(&tt);
// It's 10:40:20 ,now.
// Window Title
glutSetWindowTitle(wt);
// Bachground Paint
glClear(GL_COLOR_BUFFER_BIT);
// Watch face
// 各点の座標取得
for (i = 0 ; i < 360 ; i++)
{
theta = 2.0 * M_PI * (double)i / 360.0;
xd = xc + (int)(ld * sin(theta));
yd = yc - (int)(ld * cos(theta));
glPointSize (5.0);
tmp[i][0] = xd;
tmp[i][1] = yd;
if(maxy < yd) {
maxy = yd;
}
if(miny > yd) {
miny = yd;
}
}
//座標取得終わり
glLineWidth(3.0);
glBegin(GL_LINE_LOOP);
for(i = 0; i < 360; i++) {
glVertex2i(tmp[i][0], tmp[i][1]);
}
glEnd();
// 単振動軸
glBegin(GL_LINES);
glVertex2i(340,miny);
glVertex2i(340,maxy);
glEnd();
// 正弦波軸
glBegin(GL_LINES);
glVertex2i(450,150);
glVertex2i(650,150);
glEnd();
glColor3ub (255, 255, 255);
theta = M_PI * (double) Time / 180.0;
double Theta = theta - (M_PI/2);
// 円運動、単振動表示
tmpx = xc + (int)(ld * sin(theta));
tmpy= yc - (int)(ld * cos(theta));
glColor3ub (220 , 220, 220);
glPointSize(10.0);
glBegin(GL_POINTS);
glVertex2d(tmpx , tmpy);
glVertex2d(340 ,tmpy);
glVertex2d((double)450 + disx ,tmpy);
glEnd();
glLineWidth(1.5);
glBegin(GL_LINES);
glVertex2d(tmpx , tmpy);
glVertex2d(340 ,tmpy);
glEnd();
// 変数教示
printf("x = %.2f : ",(ld * M_PI * sin(Theta)));
printf("v = %.2f : ",(ld * M_PI * cos(Theta)));
printf("a = %.2f\n ",((-1) * ld * M_PI * M_PI * sin(Theta)));
x = (-1) * ld * M_PI * sin(Theta);
v = (-1) * ld * M_PI * cos(Theta);
a = ld * M_PI * M_PI * sin(Theta);
snprintf(xmessage, 100, "%.2f",x);
snprintf(vmessage, 100, "%.2f",v);
snprintf(amessage, 100, "%.2f", a);
glColor3ub(255, 200, 200);
PrintText(355, 50, "x:");
PrintText(375, 50, xmessage);
PrintText(355, 140, "v:");
PrintText(375, 140, vmessage);
PrintText(355, 230, "a:");
PrintText(375, 230, amessage);
// 変数表示終わり
if(Time == 0) {
Time = 360;
}else{
Time-=0.08;
}
disx += (double)200/4500;
if(disx > 200) {
disx = 0;
}
// Finish
glFlush();
glutSwapBuffers();
}
// Reset Coordinate if occurs Window Resizing
//
void Reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity();
gluOrtho2D(0 , w, 0, h);
glScaled(1, -1, 1);
glTranslated(0, -h, 0);
glutReshapeWindow(700, 300); // Window Size Fixing
}
void PrintText(int x, int y, char *s)
{
int i , l;
glRasterPos2i(x , y);
l = strlen(s);
for (i = 0 ; i < l ; i++)
{
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, s[i]);
}
}
void Keyboard(unsigned char key, int x, int y)
{
if ((key == 'q') || (key == 27))
{
printf("Finished\n");
exit(0);
}
}
// Timer Interrupt
void Timer(int value)
{
glutPostRedisplay();
glutTimerFunc(1, Timer, value);
}
|
a.cc:4:10: fatal error: GL/glut.h: No such file or directory
4 | #include <GL/glut.h>
| ^~~~~~~~~~~
compilation terminated.
|
s697646373
|
p04047
|
C++
|
//
// Analog Clock
//
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
void Display(void);
void Reshape(int,int);
void Keyboard(unsigned char, int, int);
void Timer(int);
void PrintText(int, int, char *);
char xmessage[100];
char vmessage[100];
char amessage[100];
char ohara[]="x: ";
char simizu[]="v: ";
char yokooozi[]="a: ";
double Time=90;
int ls, lm, lh; // Length of Needle
int xs, ys; // Second Hand Coordinate
int xm, ym; // Minute Hand Coordinate
int xh , yh; // Second Hand Coordinate
int xc, yc; // Center Coordinate
double xd, yd; // Scale of Panel
int ld; // Radius of Panel
int ld0; // Radius of Panel Indicate
int tmp[360][2];
double theta; // Angle
int i ; // Loop Counter
double tmpx,tmpy;
double maxy=0,miny=1e9;
char wt[20];
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize (450, 300);
glutCreateWindow("takeuti");
glutDisplayFunc(Display);
glutKeyboardFunc(Keyboard);
glutReshapeFunc(Reshape);
glutTimerFunc (1, Timer, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glClearColor(0.5, 0.0, 1.0, 1.0);
glutMainLoop();
return(0);
}
//
// Update Window Display
//
void Display(void)
{
ls = 129;
lm = 120;
lh = 90;
ld = ls + 10;
ld0 = ls-10;
xc = 150;
yc = 150;
// Getting Current Time
// time(&tt);
// ts = localtime(&tt);
// It's 10:40:20 ,now.
// Window Title
glutSetWindowTitle(wt);
// Bachground Paint
glClear(GL_COLOR_BUFFER_BIT);
// Watch face
for (i = 0 ; i < 360 ; i++)
{
theta = 2.0 * M_PI * (double)i / 360.0;
xd = xc + (int)(ld * sin(theta));
yd = yc - (int)(ld * cos(theta));
glPointSize (5.0);
tmp[i][0] = xd;
tmp[i][1] = yd;
if(maxy < yd) {
maxy = yd;
}
if(miny > yd) {
miny = yd;
}
}
glLineWidth(3.0);
glBegin(GL_LINE_LOOP);
for(i = 0; i < 360; i++) {
glVertex2i(tmp[i][0], tmp[i][1]);
}
glEnd();
glBegin(GL_LINES);
glVertex2i(340,miny);
glVertex2i(340,maxy);
glEnd();
// Needle
// Second
glColor3ub (255, 255, 255);
theta = M_PI * (double) Time / 180.0;
double Theta = theta - (M_PI/2);
tmpx = xc + (int)(ld * sin(theta));
tmpy= yc - (int)(ld * cos(theta));
glColor3ub (220 , 220, 220);
glPointSize(10.0);
glBegin(GL_POINTS);
glVertex2d(tmpx , tmpy);
glVertex2d(340 ,tmpy);
glEnd();
printf("x = %d : ",(int)(ld * M_PI * sin(Theta)));
printf("v = %d : ",(int)(ld * M_PI * cos(Theta)));
printf("a = %d\n ",(int)((-1) * ld * M_PI * M_PI * sin(Theta)));
//うおおおおおおおおおおおおおおおおおおおおおaaaaaaaaaaaaaaaaaaaaaaaa
int kura,moto,atu;
kura=(int) 150-tmpy;
moto=(int)(ld * M_PI * cos(theta));
atu=(int)((-1) * ld * M_PI * M_PI * sin(theta));
snprintf(xmessage, 100, "%d",kura);
snprintf(vmessage, 100, "%d",moto);
snprintf(amessage, 100, "%d", atu);
//glClear(GL_COLOR_BUFFER_BIT);
glColor3ub(255, 200, 200);
PrintText(355, 50, ohara);
PrintText(375, 50, xmessage);
PrintText(355, 140, simizu);
PrintText(375, 140, vmessage);
PrintText(355, 230, yokooozi);
PrintText(375, 230, amessage);
//いやあああああああああああああああああaaaaaaaaaaaaaaaaaaaaaaaaa
if(Time == 0) {
Time = 360;
}else{
Time-=0.08;
}
// Finish
glFlush();
glutSwapBuffers();
}
// Reset Coordinate if occurs Window Resizing
//
void Reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity();
gluOrtho2D(0 , w, 0, h);
glScaled(1, -1, 1);
glTranslated(0, -h, 0);
glutReshapeWindow(450, 300); // Window Size Fixing
}
// Timer Interrupt
void Timer(int value)
{
glutPostRedisplay();
glutTimerFunc(1, Timer, value);
}
void Keyboard(unsigned char key, int x, int y)
{
if ((key == 'q') || (key == 27))
{
printf("Finished\n");
exit(0);
}
}
void PrintText(int x, int y, char *s)
{
int i , l;
glRasterPos2i(x , y);
l = strlen(s);
for (i = 0 ; i < l ; i++)
{
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, s[i]);
}
}
|
a.cc:4:10: fatal error: GL/glut.h: No such file or directory
4 | #include <GL/glut.h>
| ^~~~~~~~~~~
compilation terminated.
|
s948512900
|
p04047
|
C++
|
//
// Analog Clock
//
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
void Display(void);
void Reshape(int,int);
void Keyboard(unsigned char, int, int);
void Timer(int);
double Time=90;
int ls, lm, lh; // Length of Needle
int xs, ys; // Second Hand Coordinate
int xm, ym; // Minute Hand Coordinate
int xh , yh; // Second Hand Coordinate
int xc, yc; // Center Coordinate
double xd, yd; // Scale of Panel
int ld; // Radius of Panel
int ld0; // Radius of Panel Indicate
int tmp[360][2];
double theta; // Angle
int i ; // Loop Counter
double tmpx,tmpy;
double maxy=0,miny=1e9;
char wt[20];
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize (450, 300);
glutCreateWindow("takeuti");
glutDisplayFunc(Display);
glutKeyboardFunc(Keyboard);
glutReshapeFunc(Reshape);
glutTimerFunc (1, Timer, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glClearColor(0.5, 0.0, 1.0, 1.0);
glutMainLoop();
return(0);
}
//
// Update Window Display
//
void Display(void)
{
ls = 129;
lm = 120;
lh = 90;
ld = ls + 10;
ld0 = ls-10;
xc = 150;
yc = 150;
// Getting Current Time
// time(&tt);
// ts = localtime(&tt);
// It's 10:40:20 ,now.
// Window Title
glutSetWindowTitle(wt);
// Bachground Paint
glClear(GL_COLOR_BUFFER_BIT);
// Watch face
for (i = 0 ; i < 360 ; i++)
{
theta = 2.0 * M_PI * (double)i / 360.0;
xd = xc + (int)(ld * sin(theta));
yd = yc - (int)(ld * cos(theta));
glPointSize (5.0);
tmp[i][0] = xd;
tmp[i][1] = yd;
if(maxy < yd) {
maxy = yd;
}
if(miny > yd) {
miny = yd;
}
}
glLineWidth(3.0);
glBegin(GL_LINE_LOOP);
for(i = 0; i < 360; i++) {
glVertex2i(tmp[i][0], tmp[i][1]);
}
glEnd();
glBegin(GL_LINES);
glVertex2i(340,miny);
glVertex2i(340,maxy);
glEnd();
// Needle
// Second
glColor3ub (255, 255, 255);
theta = M_PI * (double) Time / 180.0;
double Theta = theta - (M_PI/2);
tmpx = xc + (int)(ld * sin(theta));
tmpy= yc - (int)(ld * cos(theta));
glColor3ub (220 , 220, 220);
glPointSize(10.0);
glBegin(GL_POINTS);
glVertex2d(tmpx , tmpy);
glVertex2d(340 ,tmpy);
glEnd();
printf("x = %d : ",(int)(ld * M_PI * sin(Theta)));
printf("v = %d : ",(int)(ld * M_PI * cos(Theta)));
printf("a = %d\n ",(int)((-1) * ld * M_PI * M_PI * sin(Theta)));
if(Time == 0) {
Time = 360;
}else{
Time-=0.08;
}
// Finish
glFlush();
glutSwapBuffers();
}
// Reset Coordinate if occurs Window Resizing
//
void Reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity();
gluOrtho2D(0 , w, 0, h);
glScaled(1, -1, 1);
glTranslated(0, -h, 0);
glutReshapeWindow(450, 300); // Window Size Fixing
}
// Timer Interrupt
void Timer(int value)
{
glutPostRedisplay();
glutTimerFunc(1, Timer, value);
}
void Keyboard(unsigned char key, int x, int y)
{
if ((key == 'q') || (key == 27))
{
printf("Finished\n");
exit(0);
}
}
|
a.cc:4:10: fatal error: GL/glut.h: No such file or directory
4 | #include <GL/glut.h>
| ^~~~~~~~~~~
compilation terminated.
|
s631661057
|
p04047
|
C++
|
printf("x = %d : ",(int)(ld * M_PI * sin(Theta)));
printf("v = %d : ",(int)(ld * M_PI * cos(Theta)));
printf("a = %d\n ",(int)((-1) * ld * M_PI * M_PI * sin(Theta)));
|
a.cc:1:7: error: expected constructor, destructor, or type conversion before '(' token
1 | printf("x = %d : ",(int)(ld * M_PI * sin(Theta)));
| ^
a.cc:2:7: error: expected constructor, destructor, or type conversion before '(' token
2 | printf("v = %d : ",(int)(ld * M_PI * cos(Theta)));
| ^
a.cc:3:7: error: expected constructor, destructor, or type conversion before '(' token
3 | printf("a = %d\n ",(int)((-1) * ld * M_PI * M_PI * sin(Theta)));
| ^
|
s606804703
|
p04047
|
C++
|
//
// Analog Clock
//
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
void Display(void);
void Reshape(int,int);
void Timer(int);
double Time=90;
double
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize (450, 300);
glutCreateWindow("takeuti");
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
glutTimerFunc (1, Timer, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glClearColor(0.5, 0.0, 1.0, 1.0);
glutMainLoop();
return(0);
}
//
// Update Window Display
//
void Display(void)
{
int ls, lm, lh; // Length of Needle
int xs, ys; // Second Hand Coordinate
int xm, ym; // Minute Hand Coordinate
int xh , yh; // Second Hand Coordinate
int xc, yc; // Center Coordinate
double xd, yd; // Scale of Panel
int ld; // Radius of Panel
int ld0; // Radius of Panel Indicate
int tmp[360][2];
double theta; // Angle
int i ; // Loop Counter
double tmpx,tmpy;
double maxy=0,miny=1e9;
char wt[20];
ls = 129;
lm = 120;
lh = 90;
ld = ls + 10;
ld0 = ls-10;
xc = 150;
yc = 150;
// Getting Current Time
// time(&tt);
// ts = localtime(&tt);
// It's 10:40:20 ,now.
// Window Title
glutSetWindowTitle(wt);
// Bachground Paint
glClear(GL_COLOR_BUFFER_BIT);
// Watch face
for (i = 0 ; i < 360 ; i++)
{
theta = 2.0 * M_PI * (double)i / 360.0;
xd = xc + (int)(ld * sin(theta));
yd = yc - (int)(ld * cos(theta));
glPointSize (5.0);
tmp[i][0] = xd;
tmp[i][1] = yd;
if(maxy < yd) {
maxy = yd;
}
if(miny > yd) {
miny = yd;
}
}
glLineWidth(3.0);
glBegin(GL_LINE_LOOP);
for(i = 0; i < 360; i++) {
glVertex2i(tmp[i][0], tmp[i][1]);
}
glEnd();
glBegin(GL_LINES);
glVertex2i(340,miny);
glVertex2i(340,maxy);
glEnd();
// Needle
// Second
glColor3ub (255, 255, 255);
theta = M_PI * (double) Time / 180.0;
tmpx = xc + (int)(ld * sin(theta));
tmpy= yc - (int)(ld * cos(theta));
glColor3ub (220 , 220, 220);
glPointSize(10.0);
glBegin(GL_POINTS);
glVertex2d(tmpx , tmpy);
glVertex2d(340 ,tmpy);
glEnd();
if(Time == 0) {
Time = 360;
}else{
Time-=0.80;
}
// Finish
glFlush();
glutSwapBuffers();
}
// Reset Coordinate if occurs Window Resizing
//
void Reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity();
gluOrtho2D(0 , w, 0, h);
glScaled(1, -1, 1);
glTranslated(0, -h, 0);
glutReshapeWindow(450, 300); // Window Size Fixing
}
// Timer Interrupt
void Timer(int value)
{
glutPostRedisplay();
glutTimerFunc(5.8, Timer, value);
}
|
a.cc:4:10: fatal error: GL/glut.h: No such file or directory
4 | #include <GL/glut.h>
| ^~~~~~~~~~~
compilation terminated.
|
s251632476
|
p04047
|
C++
|
//
// Analog Clock
//
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
void Display(void);
void Reshape(int,int);
void Timer(int);
double Time=360;
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize (600, 300);
glutCreateWindow("takeuti");
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
glutTimerFunc (1, Timer, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glClearColor(0.5, 0.0, 1.0, 1.0);
glutMainLoop();
return(0);
}
//
// Update Window Display
//
void Display(void)
{
int ls, lm, lh; // Length of Needle
int xs, ys; // Second Hand Coordinate
int xm, ym; // Minute Hand Coordinate
int xh , yh; // Second Hand Coordinate
int xc, yc; // Center Coordinate
int xd, yd; // Scale of Panel
int ld; // Radius of Panel
int ld0; // Radius of Panel Indicate
int tmp[360][2];
double theta; // Angle
int i ; // Loop Counter
double tmpx,tmpy;
double maxy=0,miny=1e9;
char wt[20];
ls = 129;
lm = 120;
lh = 90;
ld = ls + 10;
ld0 = ls-10;
xc = 150;
yc = 150;
// Getting Current Time
// time(&tt);
// ts = localtime(&tt);
// It's 10:40:20 ,now.
// Window Title
glutSetWindowTitle(wt);
// Bachground Paint
glClear(GL_COLOR_BUFFER_BIT);
// Watch face
for (i = 0 ; i < 360 ; i++)
{
theta = 2.0 * M_PI * (double)i / 360.0;
xd = xc + (int)(ld * sin(theta));
yd = yc - (int)(ld * cos(theta));
glPointSize (5.0);
tmp[i][0] = xd;
tmp[i][1] = yd;
if(maxy < yd) {
maxy = yd;
}
if(miny > yd) {
miny = yd;
}
}
glLineWidth(3.0);
glBegin(GL_LINE_LOOP);
for(i = 0; i < 360; i++) {
glVertex2i(tmp[i][0], tmp[i][1]);
}
glEnd();
glBegin(GL_LINES);
glVertex2i(340,miny);
glVertex2i(340,maxy);
glEnd();
// Needle
// Second
glColor3ub (255, 255, 255);
theta = 2.0 * M_PI * (double) Time / 60.0;
tmpx = xc + (int)(ld * sin(theta));
tmpy= yc - (int)(ld * cos(theta));
glColor3ub (220 , 220, 220);
glPointSize(10.0);
glBegin(GL_POINTS);
glVertex2d(tmpx , tmpy);
glVertex2d(340 ,tmpy);
glEnd();
if(Time == 0) {
Time = 360;
}else{
Time-=0.18;
}
// Finish
glFlush();
glutSwapBuffers();
}
// Reset Coordinate if occurs Window Resizing
//
void Reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity();
gluOrtho2D(0 , w, 0, h);
glScaled(1, -1, 1);
glTranslated(0, -h, 0);
glutReshapeWindow(600, 300); // Window Size Fixing
}
// Timer Interrupt
void Timer(int value)
{
glutPostRedisplay();
glutTimerFunc(5.8, Timer, value);
}
|
a.cc:4:10: fatal error: GL/glut.h: No such file or directory
4 | #include <GL/glut.h>
| ^~~~~~~~~~~
compilation terminated.
|
s999047345
|
p04047
|
C++
|
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
typedef long long ll;
using namespace std;
int main() {
vector<int> a;
int N,n;
scanf("%d", &N);
for (int i = 0; i < 2 * N - 1; i++) {
scanf("%d", &n);
a.push_back(n);
}
sort(a.begin(), a.end);
int sum = 0;
for (int i = 0; i < N; i++) {
sum += a[2 * N];
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:16:13: error: no matching function for call to 'sort(std::vector<int>::iterator, <unresolved overloaded function type>)'
16 | sort(a.begin(), a.end);
| ~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:63: note: no known conversion for argument 2 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.