submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s513635323 | p03912 | C++ | #include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<limits>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
int k=0;
int x[100100];
for(int i=0;i<n;i++){
cin>>x[i];
}
int y[100100]={};
for(int i=0;i<n;i++){
y[x[i]]+=1;
}
int z[100100]={};
int w[100100]={};
for(int i=0;i<100001;i++){
z[i%m]+=y[i];
w[i%m]+=(y[i]/2);
}
if(m%2==1){
k+=z[0]/2;
for(int i=1;i<=m/2;i++){
if(z[i]>=z[m-i]){
k+=z[m-i];
if((z[i]-z[m-i])/2>=w[i]){
k+=w[i];
}else
{
k+=(z[i]-z[m-i])/2;
}
}else
{
k=[i];
if((z[m-i]-z[i])/2>=w[m-i]){
k+=w[m-i];
}else
{
k+=(z[m-i]-z[i])/2;
}
}
}
}else
{
k+=z[0]/2;
k+=z[m/2]/2;
for(int i=1;i<m/2;i++){
if(z[i]>=z[m-i]){
k+=z[m-i];
if((z[i]-z[m-i])/2>=w[i]){
k+=w[i];
}else
{
k+=(z[i]-z[m-i])/2;
}
}else
{
k+=z[i];
if((z[m-i]-z[i])/2>=w[m-i]){
k+=w[m-i];
}else
{
k+=(z[m-i]-z[i])/2;
}
}
}
}
cout<<k<<endl;
return 0;
} | a.cc: In lambda function:
a.cc:44:22: error: expected '{' before ';' token
44 | k=[i];
| ^
a.cc: In function 'int main()':
a.cc:44:19: error: cannot convert 'main()::<lambda()>' to 'int' in assignment
44 | k=[i];
| ^~~
| |
| main()::<lambda()>
|
s873987182 | p03912 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;
int main(){
ll n, m, a, b, s;
in2(n, m);
vector<pair<ll, ll>> c(n), d(n);
rep(i, n){
in(a);
d[i].first = a % m;
d[i].second = i;
c[i].first = a;
c[i].second = 0;
}
sort(all(d));
a = 0;
b = n - 1;
s = 0;
while(a < b){
if((d[a].first + d[b].first) % m == 0){
s++;
c[d[a].second].second = 1;
c[d[b].second].second = 1;
a++;
b--;
continue;
}
if(a + b < m)
a++;
else
b--;
}
a = 0;
sort(all(c));
while(a < n - 1){
if(c[i].first == c[i + 1].first){
if(c[i].second == 0 && c[i + 1].second == 0){
s++;
a += 2;
}
else
a++;
}
else
a++;
}
out(s);
memi;
} | a.cc: In function 'int main()':
a.cc:49:10: error: 'i' was not declared in this scope
49 | if(c[i].first == c[i + 1].first){
| ^
|
s275672991 | p03912 | C++ | #include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <set>
using namespace std;
typedef long long int ll;
int main(){
int n,m; cin >> n >> m;
vector<int> v[m];
vector<int> x(n);
for(int i=0;i<n;i++){
cin >> x[i];
}
sort(x.begin()、x.end());
for(int i = 0; i <n; i ++){
v [x [i]%m] .push_back(x [i]);
}
ll ans = 0;
ans + = v [0] .size()/ 2;
if(m%2 == 0){
ans + = v [m / 2] .size()/ 2;
}
for(int i = 1; i <=(m-1)/ 2; i ++){
if(v [i] .size()> v [mi] .size()){
swap(v [i]、v [mi]);
}
int cnt = 0;
for(int j = 0; j <v [mi] .size(); j ++){
int cp = v [mi] [j];
int res = 0;
while(cp == v [mi] [j]){
res ++;
j ++;
}
j--;
cnt + = res / 2;
}
ans + = min(cnt、(int)(v [mi] .size()-v [i] .size())/ 2);
ans + = v [i] .size();
}
cout << ans << endl;
}
| a.cc:16:17: error: extended character 、 is not valid in an identifier
16 | sort(x.begin()、x.end());
| ^
a.cc:27:36: error: extended character 、 is not valid in an identifier
27 | swap(v [i]、v [mi]);
| ^
a.cc:40:25: error: extended character 、 is not valid in an identifier
40 | ans + = min(cnt、(int)(v [mi] .size()-v [i] .size())/ 2);
| ^
a.cc: In function 'int main()':
a.cc:16:9: error: 'sort\U0000ff08x' was not declared in this scope
16 | sort(x.begin()、x.end());
| ^~~~~~~
a.cc:17:9: error: 'for\U0000ff08int' was not declared in this scope
17 | for(int i = 0; i <n; i ++){
| ^~~~~~~~
a.cc:17:25: error: 'i' was not declared in this scope
17 | for(int i = 0; i <n; i ++){
| ^
a.cc:21:15: error: expected primary-expression before '=' token
21 | ans + = v [0] .size()/ 2;
| ^
a.cc:21:24: error: 'class std::vector<int>' has no member named 'size\U0000ff08\U0000ff09'
21 | ans + = v [0] .size()/ 2;
| ^~~~~~~~
a.cc:22:9: error: 'if\U0000ff08m\U0000ff052' was not declared in this scope
22 | if(m%2 == 0){
| ^~~~~~~~
a.cc:22:21: error: unable to find numeric literal operator 'operator""\U0000ff09'
22 | if(m%2 == 0){
| ^~~
a.cc:25:17: error: expected ';' before 'i'
25 | for(int i = 1; i <=(m-1)/ 2; i ++){
| ^~
| ;
a.cc:25:29: error: '\U0000ff08m' was not declared in this scope
25 | for(int i = 1; i <=(m-1)/ 2; i ++){
| ^~~
a.cc:25:33: error: unable to find numeric literal operator 'operator""\U0000ff09'
25 | for(int i = 1; i <=(m-1)/ 2; i ++){
| ^~~
|
s877631849 | p03912 | C++ | 15 10
1 5 6 10 11 11 11 20 21 25 25 26 99 99 99 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 15 10
| ^~
|
s174903351 | p03912 | C++ | constexpr int MAX_SIZE = 1e5 + 1;
std::vector<int> A;
std::vector<int> Count(MAX_SIZE, 0);
int main(void){
int n, m; scanf("%d%d", &n, &m);
A.resize(m, 0);
REP(i, n) {
int a; scanf("%d", &a);
A[a % m]++;
Count[a]++;
}
REP(x, MAX_SIZE) A[x % m] += (Count[x] >> 1);
// x個あって, aペア作れる <~> y個あって, bペア作れる
int cnt = 0;
REP(i, m){
int j = (m - i) % m;
if(j < i) break;
if(i == j) {cnt += Count[i]; continue;}
int p = std::min(A[i], A[j]);
cnt += p; A[i] -= p; A[j] -= p;
int q1 = std::min(A[i] / 2, Count[i]);
int q2 = std::min(A[j] / 2, Count[j]);
cnt += q1 + q2;
}
printf("%d\n", cnt);
return 0;
}
| a.cc:2:6: error: 'vector' in namespace 'std' does not name a template type
2 | std::vector<int> A;
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | constexpr int MAX_SIZE = 1e5 + 1;
a.cc:3:6: error: 'vector' in namespace 'std' does not name a template type
3 | std::vector<int> Count(MAX_SIZE, 0);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
3 | std::vector<int> Count(MAX_SIZE, 0);
| ^~~
a.cc: In function 'int main()':
a.cc:7:15: error: 'scanf' was not declared in this scope
7 | int n, m; scanf("%d%d", &n, &m);
| ^~~~~
a.cc:8:5: error: 'A' was not declared in this scope
8 | A.resize(m, 0);
| ^
a.cc:9:9: error: 'i' was not declared in this scope
9 | REP(i, n) {
| ^
a.cc:9:5: error: 'REP' was not declared in this scope
9 | REP(i, n) {
| ^~~
a.cc:14:9: error: 'x' was not declared in this scope
14 | REP(x, MAX_SIZE) A[x % m] += (Count[x] >> 1);
| ^
a.cc:28:5: error: 'printf' was not declared in this scope
28 | printf("%d\n", cnt);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | constexpr int MAX_SIZE = 1e5 + 1;
|
s860768644 | p03912 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(int argc, char* argv[]){
int n,m; cin >> n >> m;
vector<vector<int>> x(m, vector<int>(0));
for(int i = 0; i < n ; i++){
int a; cin >> a;
if(a % m == 0) x[0].push_back(a);
else x[a%m].push_back(a);
}
int ans = 0;
for(int i = 0; i < x.size()/2 + 1; i++){
if(i%m == 0) ans += (x[0].size() - (x[0].size()%2))/2;
else if((i * 2) % m == 0) ans += (x[i].size() - x[i].size()%2)/2;
else{
int a,b;
if(x[i].size() > x[m-i].size()){
a = i;
b = m - i;
}
else{
a = m - i;
b = i;
}
ans += x[b].size();
int count = 0;
sort(x[a].begin(), x[a].end());
for(int j = 0; j < x[a].size()-1 ; j++){
if(x[a].size() - x[b].size() >= count+2){
if(x[a][j] == x[a][j+1]){
count ++;
j++;
}
}
else break;
}
ans += count;
}
}
cout << ans << endl;
}
| a.cc: In function 'int main(int, char**)':
a.cc:29:7: error: 'sort' was not declared in this scope; did you mean 'short'?
29 | sort(x[a].begin(), x[a].end());
| ^~~~
| short
|
s954017194 | p03912 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
signed main(){
int n,m;cin>>n>>m;
vector<int>x(n);
for(auto&& u:x)cin>>u;
map<int,vector<int>> div;
for(auto&& u:x)div[u%m].push_back(u);
int ret=0;
ret+=div[0].size()/2;
if(m%2==0)ret+=div[m/2].size()/2;
for(int i=1;i<=(m-1)/2;i++){
int x=i,y=m-x;
int nx=div[x].size(),ny=div[y].size();
if(nx>ny)swap(x,y);
ret+=nx;
int pr=0;
map<int,int>cnt;
for(auto&& u:div[y])div[u]++;
for(auto&& u:cnt)pr+=u.second/2;
ret+=min(ny-nx,pr);
}
cout<<ret<<endl;
}
| a.cc: In function 'int main()':
a.cc:22:43: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
22 | for(auto&& u:div[y])div[u]++;
|
s126963310 | p03912 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
signed main(){
int n,m;cin>>n>>m;
vector<int>x(n);
for(auto&& u:x)cin>>u;
map<int,vector<int>> div;
for(auto&& u:x)div[u%m].push_back(u);
int ret=0;
ret+=div[0].size()/2;
if(m%2==0)ret+=div[m/2].size()/2;
for(int i=1;i<m/2;i++){
int x=i,y=m-x;
int nx=div[x].size(),ny=div[y].size();
if(nx>ny)swap(x,y);
ret+=nx;
int pr=0;
for(int j=0;j<y-1;j++){
sort(begin(div[y]),end(div[y]);
if(div[y][j]==div[y][j+1]){pr++;j++;}
}
ret+=min(ny-nx,pr);
}
cout<<ret<<endl;
}
| a.cc: In function 'int main()':
a.cc:22:55: error: expected ')' before ';' token
22 | sort(begin(div[y]),end(div[y]);
| ~ ^
| )
|
s939054158 | p03912 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
signed main(){
int n,m;cin>>n>>m;
vector<int>x(n);
for(auto&& u:x)cin>>u;
map<int,vector<int>> div;
for(auto&& u:x)div[u%m].push_back(u);
int ret=0;
ret+=div[0].size()/2;
if(m%2==0)ret+=div[m/2].size()/2;
for(int i=1;i<m/2;i++){
int x=i,y=m-x;
int nx=div[x].size(),ny=div[y].size();
if(nx>ny)swap(x,y);
ret+=nx;
int pr=0;
for(int j=0;j<y-1;j++){
if(div[y][j]==div[y][j+1]{pr++;j++;}
}
ret+=min(ny-nx,pr);
}
cout<<ret<<endl;
}
| a.cc: In function 'int main()':
a.cc:22:50: error: expected ')' before '{' token
22 | if(div[y][j]==div[y][j+1]{pr++;j++;}
| ~ ^
| )
a.cc:23:17: error: expected primary-expression before '}' token
23 | }
| ^
|
s460403812 | p03912 | C++ | #define _UsecondE_MATH_DEfirstINEsecond
#define _CRT_secondECURE_NO_WARNINGsecond
#include <bits/stdc++.h>
using namespace std;
/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))
//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIsecondT(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
sort(ALL(c)); \
for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))
// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;
// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountint((a))
//typedef
typedef long long lint;
typedef unsigned long long uint;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
//constant
constexpr int INfirst = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPsecond = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};
//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T>
inline string tosecondtring(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
//
struct Accelerate_Cin {
Accelerate_Cin() {
cin.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(20);
};
} Accelerate_Cin;
signed main() {
int n, m;
cin >> n >> m;
vector<P> cnt(100010);
vector<int> pint(100010);
for (int i = 0; i < n; i++) {
int num;
cin >> num;
pint[num]++;
}
for (int i = 0; i < 100010; i++) {
if (pint[i] > 0) {
cnt[i % m].first += pint[i];
cnt[i % m].second += pint[i] / 2;
}
}
int ans = 0;
ans += cnt[0].first / 2;
for (int i = 1; i <= m / 2; i++) {
if (i == m - i) {
ans += cnt[i].first / 2;
} else {
ans += min(cnt[i].first, cnt[m - i].first);
if (cnt[i].first > cnt[m - i].first) {
ans += min(cnt[i].second, (cnt[i].first - cnt[m - i].first) / 2);
} else {
ans += min(cnt[m - i].second, (cnt[m - i].first - cnt[i].first) / 2);
}
}
}
cout << ans << endl;
return 0;
}
| a.cc:43:28: error: conflicting declaration 'typedef long long unsigned int uint'
43 | typedef unsigned long long uint;
| ^~~~
In file included from /usr/include/stdlib.h:514,
from /usr/include/c++/14/cstdlib:79,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
from a.cc:3:
/usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration as 'typedef unsigned int uint'
150 | typedef unsigned int uint;
| ^~~~
|
s310342034 | p03912 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
int main() {
long long n, m, t, ret = 0;
std::cin >> n >> m;
std::vector<std::map<long long, long long>> x(m);
for (auto i = 0ll; i < n; i++) {
std::cin >> t;
x[t % m][t]++;
}
auto bo = [](auto acc, auto& p) { return acc + p.second; };
ret += std::accumulate(x[0].begin(), x[0].end(), 0ll, bo) / 2;
if (m % 2 == 0) ret += std::accumulate(x[m / 2].begin(), x[m / 2].end(), 0ll, bo) / 2;
for (auto i = 1; i < (m + 1) / 2; i++) {
auto ssum = std::accumulate(x[i].begin(), x[i].end(), 0ll, bo);
auto bsum = std::accumulate(x[m - i].begin(), x[m - i].end(), 0ll, bo);
if (bsum > ssum) {
x[i].swap(x[m - i]);
std::swap(ssum, bsum);
}
auto multiels = std::accumulate(x[i].begin(), x[i].end(), 0ll, [](auto acc, auto& el) { return acc + el.second / 2 * 2; });
if (ssum - multiels >= bsum) {
ret += bsum + multiels / 2;
} else {
ret += bsum + (ssum - bsum) / 2;
}
}
std::cout << ret << std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:17: error: 'accumulate' is not a member of 'std'
17 | ret += std::accumulate(x[0].begin(), x[0].end(), 0ll, bo) / 2;
| ^~~~~~~~~~
a.cc:18:33: error: 'accumulate' is not a member of 'std'
18 | if (m % 2 == 0) ret += std::accumulate(x[m / 2].begin(), x[m / 2].end(), 0ll, bo) / 2;
| ^~~~~~~~~~
a.cc:21:26: error: 'accumulate' is not a member of 'std'
21 | auto ssum = std::accumulate(x[i].begin(), x[i].end(), 0ll, bo);
| ^~~~~~~~~~
a.cc:22:26: error: 'accumulate' is not a member of 'std'
22 | auto bsum = std::accumulate(x[m - i].begin(), x[m - i].end(), 0ll, bo);
| ^~~~~~~~~~
a.cc:27:30: error: 'accumulate' is not a member of 'std'
27 | auto multiels = std::accumulate(x[i].begin(), x[i].end(), 0ll, [](auto acc, auto& el) { return acc + el.second / 2 * 2; });
| ^~~~~~~~~~
|
s632612219 | p03912 | C++ | #include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#include"basic.cpp"
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)
int main(){
int n, m;
cin >> n >> m;
vector<pair<int, int>> vec;
map<int, map<int, int>> nums;
for(int i=0;i<n;i++){
int x;
cin >> x;
vec.emplace_back(x % m, x);
nums[x % m][x]++;
}
// sort(vec.begin(), vec.end());
// int num = vec[1].second;
// int num2 = lower_bound(vec.begin(), vec.end(), pair<int, int>{m - num, -1}) -> second;
// cout<<num<<' '<<num2<<endl;
// println(nums);
int ans = 0;
for(int i=0;i<m;i++){
if(i == (m - i) % m){
int s1 = 0;
auto& m1 = nums[i];
for(auto& p : m1){ s1 += p.second; }
ans += s1 / 2;
}else{
if(i > (m - i) % m){ break; }
// if(!nums.count(i) || !nums.count((m - i) % m)){ continue; }
auto& m1 = nums[i];
auto& m2 = nums[(m - i) % m];
int s1 = 0, s2 = 0;
for(auto& p : m1){ s1 += p.second; }
for(auto& p : m2){ s2 += p.second; }
ans += min(s1, s2);
if(s1 == s2){ continue; }
if(s1 < s2){
swap(s1, s2);
swap(m1, m2);
}
vector<int> v;
for(auto& p : m1){ v.push_back(p.second); }
sort(v.begin(), v.end());
// sort(v.begin(), v.end(), [](int a, int b){return (a % 2) < (b % 2); });
// sort(v.begin(), v.end(), [](int a, int b){return !((a % 2) == 0 && (b % 2) == 1); });
// sort(v.begin(), v.end(), [](int a, int b){return ((a % 2) == 1 && (b % 2) == 0); });
// println(v);
// sort(v.begin(), v.end(), [](int a, int b){return (a % 2) < (b % 2); });
for(int& i : v){
if(i % 2 == 1){
if(s2 == 0){
break;
}
s2--;
i--;
}
}
sort(v.begin(), v.end());
for(int& i : v){
int d = min(i, s2);
s2 -= d;
i -= d;
}
for(int& i : v){
// cnt += i;
ans += i / 2;
}
}
}
cout << ans << endl;
return 0;
}
| a.cc:10:9: fatal error: basic.cpp: No such file or directory
10 | #include"basic.cpp"
| ^~~~~~~~~~~
compilation terminated.
|
s129787967 | p03912 | C++ | #include<iostream>
#include<map>
#include<vector>
int main(){
int n,m;
std::cin >> n >> m;
std::vector<int> x(n);
std::map<int,std::map<int,int> > units;
std::map<int,std::map<int,int> > buf;
std::vector<int> oddExist(m);
for(int i=0;i<n;i++){
std::cin >> x[i];
if(buf[x[i]%m].find(x[i])==buf[x[i]%m].end()){
if(units[x[i]%m].find(x[i])!=units[x[i]%m].end()){
buf[x[i]%m][x[i]] = 2;
units[x[i]%m].erase(x[i]);
}else{
units[x[i]%m][x[i]] = 1;
}
}else{
buf[x[i]%m][x[i]]++;
}
}
/*for(int i=0;i<m;i++){
std::cout << "[" << i << "]";
auto u = buf[i];
for(auto it=u.begin();it!=u.end();it++){
std::cout << "(" << it->first << "," << it->second << ")";
}
std::cout << std::endl;
}*/
int count = 0;
for(int i=0;i<m;i++){
if(units.find(i)==units.end())continue;
auto &u = units[i];
if(i==0 || i*2==m){
count += u.size()/2;
if(u.size()%2==1){
buf[i][0]++;
}
}else if(units.find(m-i)!=units.end()){
auto &v = units[m-i];
count += std::min(u.size(),v.size());
if(u.size() > v.size()){
buf[i][0]+=u.size()-v.size();
}else if(u.size() < v.size()){
buf[m-i][0]+=v.size()-u.size();
}
units.erase(i);
units.erase(m-i);
}else{
buf[i][0]+=u.size();
}
}
for(int i=0;i<m;i++){
oddExist[i] = false;
if(buf.find(i)==buf.end())continue;
auto &u = buf[i];
if(u.find(0)!=u.end()){
oddExist[i] = true;
continue;
}
for(auto it=u.begin();it!=u.end();it++){
if(it->second%2==1){
oddExist[i] = true;
break;
}
}
}
/*std::cout << count << std::endl;
for(int i=0;i<m;i++){
std::cout << "[" << i << "]";
auto u = buf[i];
for(auto it=u.begin();it!=u.end();it++){
std::cout << "(" << it->first << "," << it->second << ")";
}
std::cout << std::endl;
}*/
while(1){
bool update = false;
for(auto pt=buf.begin();pt!=buf.end();pt++){
int i = pt->first;
auto &u = pt->second;
if(i==0 || i*2==m){
if(oddExist[i])for(auto it=u.begin();it!=u.end();it++){
if(it->second%2==1 || it->first==0){
bool po = false;
for(auto jt=it;jt!=u.end();jt++){
if(it!=jt && (jt->second%2==1 || jt->first==0)){
it->second--;
jt->second--;
count++;
update = po = true;
if(jt->second==0){
u.erase(jt);
}
break;
}
}
if(!po){
for(auto jt=u.begin();jt!=u.end();jt++){
if(it==jt)continue;
it->second--;
jt->second--;
count++;
update = po = true;
if(jt->second==0){
u.erase(jt);
}
break;
}
}
if(po){
if(it->second==0){
it = u.erase(it);
if(it==u.end())break;
else it--;
}
}
}
}
}else{
int j = m-i;
if(buf.find(j)==buf.end())continue;
auto &v = buf[j];
if(oddExist[i])for(auto it=u.begin();it!=u.end();it++){
if(it->second%2==1 || it->first==0){
bool po = false;
if(oddExist[j])for(auto jt=v.begin();jt!=v.end();jt++){
if(jt > v.begin()+100)break;
if(jt->second%2==1 || jt->first==0){
it->second--;
jt->second--;
count++;
update = po = true;
if(jt->second==0){
v.erase(jt);
}
break;
}
}
if(!po){
for(auto jt=v.begin();jt!=v.end();jt++){
it->second--;
jt->second--;
count++;
update = po = true;
if(jt->second==0){
v.erase(jt);
}else oddExist[j] = true;
break;
}
}
if(po){
if(it->second==0){
it = u.erase(it);
if(it==u.end())break;
else it--;
}
}
}
}
}
if(u.size()==0){
pt = buf.erase(pt);
if(pt==buf.end())break;
else pt--;
}
}
if(!update)break;
}
for(auto pt=buf.begin();pt!=buf.end();pt++){
int i = pt->first;
auto &u = pt->second;
for(auto it=u.begin();it!=u.end();it++){
if(it->first!=0)count += it->second/2;
}
}
std::cout << count << std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:131:32: error: no match for 'operator+' (operand types are 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} and 'int')
131 | if(jt > v.begin()+100)break;
| ~~~~~~~~~^~~~
| | |
| | int
| std::map<int, int>::iterator {aka std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator}
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
131 | if(jt > v.begin()+100)break;
| ^~~
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: mismatched types 'const _CharT*' and 'std::_Rb_tree_iterator<std::pair<const int, int> >'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: mismatched types 'const _CharT*' and 'std::_Rb_tree_iterator<std::pair<const int, int> >'
131 | if(jt > v.begin()+100)break;
| ^~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:131:33: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
131 | if(jt > v.begin()+ |
s864383187 | p03912 | C++ | #include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)
#include"basic.cpp"
int main(){
int n, m;
cin >> n >> m;
vector<pair<int, int>> vec;
map<int, map<int, int>> nums;
for(int i=0;i<n;i++){
int x;
cin >> x;
vec.emplace_back(x % m, x);
nums[x % m][x]++;
}
// sort(vec.begin(), vec.end());
// int num = vec[1].second;
// int num2 = lower_bound(vec.begin(), vec.end(), pair<int, int>{m - num, -1}) -> second;
// cout<<num<<' '<<num2<<endl;
// println(nums);
int ans = 0;
for(int i=0;i<m;i++){
if(!nums.count(i)){ continue; }
auto p1 = nums[i].begin(), p2 = nums[(m - i) % m].begin();
while(p1 != nums[i].end() && p1 -> second != 1){ p1++; }
if(p1 == nums[i].end()){ continue; }
int n1 = p1 -> first;
while(p2 != nums[(m - i) % m].end() && (p2 -> second == 0 || n1 == p2 -> first)){ p2++; }
if(p2 == nums[(m - i) % m].end()){ continue; }
int n2 = p2 -> first;
// cout<<n1<<' '<<n2<<endl;
if(n1 != n2){
nums[i][n1]--;
nums[(m - i) % m][n2]--;
// cout<<' '<<n1<<' '<<n2<<endl;
ans++;
i--;
}
}
for(int i=0;i<m;i++){
if(!nums.count(i)){ continue; }
auto p1 = nums[i].begin(), p2 = nums[(m - i) % m].begin();
while(p1 != nums[i].end() && p1 -> second == 0){ p1++; }
if(p1 == nums[i].end()){ continue; }
int n1 = p1 -> first;
while(p2 != nums[(m - i) % m].end() && (p2 -> second == 0 || n1 == p2 -> first)){ p2++; }
if(p2 == nums[(m - i) % m].end()){ continue; }
int n2 = p2 -> first;
// cout<<n1<<' '<<n2<<endl;
if(n1 != n2){
nums[i][n1]--;
nums[(m - i) % m][n2]--;
// cout<<' '<<n1<<' '<<n2<<endl;
ans++;
i--;
}
}
for(int i=0;i<m;i++){
if(!nums.count(i)){ continue; }
for(auto& p : nums[i]){
if(p.second >= 2){
ans += p.second / 2;
}
}
}
cout << ans << endl;
return 0;
}
| a.cc:15:9: fatal error: basic.cpp: No such file or directory
15 | #include"basic.cpp"
| ^~~~~~~~~~~
compilation terminated.
|
s900504467 | p03912 | C++ | #include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
constexpr int MOD = 1000000007;
typedef long long int;
typedef pair<int, int> P;
typedef pair<int, int> Pint;
int N, M;
int X[100010];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> M;
for (int j = 0; j < N; ++j) {
int v;
cin >> v;
X[v] ++;
}
int ret = 0;
int count_0 = 0;
for (int k = 0; k <= 100000; k += M) {
count_0 += X[k];
}
ret += count_0 / 2;
int rest = count_0;
for (int k = 0; k <= 100000 && rest > 0; k += M) {
if (X[k] % 2 == 1) {
--X[k];
--rest;
}
}
for (int k = 0; k <= 100000 && rest > 0; k += M) {
int dec = min(X[k], rest);
X[k] -= dec;
rest -= dec;
}
for (int j = 1; j <= M/2; ++j) {
int rj = M - j;
int count_j = 0;
for (int k = j; k <= 100000; k += M) {
count_j += X[k];
}
int count_rj = 0;
for (int k = rj; k <= 100000; k += M) {
count_rj += X[k];
}
int inc = min(count_j, count_rj);
if (j == rj) {
ret += inc / 2;
} else {
ret += inc;
}
int rest = inc;
for (int k = j; k <= 100000 && rest > 0; k += M) {
if (X[k] % 2 == 1) {
--X[k];
--rest;
}
}
for (int k = j; k <= 100000 && rest > 0; k += M) {
int dec = min(X[k], rest);
X[k] -= dec;
rest -= dec;
}
rest = inc;
if (j != rj) {
for (int k = rj; k <= 100000 && rest > 0; k += M) {
if (X[k] % 2 == 1) {
--X[k];
--rest;
}
}
for (int k = j; k <= 100000 && rest > 0; k += M) {
int dec = min(X[k], rest);
X[k] -= dec;
rest -= dec;
}
}
}
for (int j = 0; j <= 100000; ++j) {
ret += X[j] / 2;
}
cout << ret << endl;
return 0;
}
| a.cc:21:19: error: declaration does not declare anything [-fpermissive]
21 | typedef long long int;
| ^~~
|
s214134686 | p03912 | C++ | 15 10
1 5 6 10 11 11 11 20 21 25 25 26 99 99 99 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 15 10
| ^~
|
s517360182 | p03912 | C++ | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author RiaD
*/
#include <iostream>
#include <fstream>
#include <iostream>
#include <iterator>
#include <string>
#include <stdexcept>
#ifndef SPCPPL_ASSERT
#ifdef SPCPPL_DEBUG
#define SPCPPL_ASSERT(condition) \
if(!(condition)) { \
throw std::runtime_error(std::string() + #condition + " in line " + std::to_string(__LINE__) + " in " + __PRETTY_FUNCTION__); \
}
#else
#define SPCPPL_ASSERT(condition)
#endif
#endif
/**
* Support decrementing and multi-passing, but not declared bidirectional(or even forward) because
* it's reference type is not a reference.
*
* It doesn't return reference because
* 1. Anyway it'll not satisfy requirement [forward.iterators]/6
* If a and b are both dereferenceable, then a == b if and only if *a and
* b are bound to the same object.
* 2. It'll not work with reverse_iterator that returns operator * of temporary which is temporary for this iterator
*
* Note, reverse_iterator is not guaranteed to work now too since it works only with bidirectional iterators,
* but it's seems to work at least on my implementation.
*
* It's not really useful anywhere except iterating anyway.
*/
template <typename T>
class IntegerIterator: public std::iterator<std::input_iterator_tag, T, std::ptrdiff_t, T*, T> {
public:
explicit IntegerIterator(T value): value(value) {
}
IntegerIterator& operator++() {
++value;
return *this;
}
IntegerIterator operator++(int) {
IntegerIterator copy = *this;
++value;
return copy;
}
IntegerIterator& operator--() {
--value;
return *this;
}
IntegerIterator operator--(int) {
IntegerIterator copy = *this;
--value;
return copy;
}
T operator*() const {
return value;
}
bool operator==(IntegerIterator rhs) const {
return value == rhs.value;
}
bool operator!=(IntegerIterator rhs) const {
return !(*this == rhs);
}
private:
T value;
};
template <typename T>
class IntegerRange {
public:
IntegerRange(T begin, T end): begin_(begin), end_(end) {
SPCPPL_ASSERT(begin <= end);
}
IntegerIterator<T> begin() const {
return IntegerIterator<T>(begin_);
}
IntegerIterator<T> end() const {
return IntegerIterator<T>(end_);
}
private:
T begin_;
T end_;
};
template <typename T>
class ReversedIntegerRange {
typedef std::reverse_iterator<IntegerIterator<T>> IteratorType;
public:
ReversedIntegerRange(T begin, T end): begin_(begin), end_(end) {
SPCPPL_ASSERT(begin >= end);
}
IteratorType begin() const {
return IteratorType(IntegerIterator<T>(begin_));
}
IteratorType end() const {
return IteratorType(IntegerIterator<T>(end_));
}
private:
T begin_;
T end_;
};
template <typename T>
IntegerRange<T> range(T to) {
return IntegerRange<T>(0, to);
}
template <typename T>
IntegerRange<T> range(T from, T to) {
return IntegerRange<T>(from, to);
}
template <typename T>
IntegerRange<T> inclusiveRange(T to) {
return IntegerRange<T>(0, to + 1);
}
template <typename T>
IntegerRange<T> inclusiveRange(T from, T to) {
return IntegerRange<T>(from, to + 1);
}
template <typename T>
ReversedIntegerRange<T> downrange(T from) {
return ReversedIntegerRange<T>(from, 0);
}
template <typename T>
ReversedIntegerRange<T> downrange(T from, T to) {
return ReversedIntegerRange<T>(from, to);
}
template <typename T>
ReversedIntegerRange<T> inclusiveDownrange(T from) {
return ReversedIntegerRange<T>(from + 1, 0);
}
template <typename T>
ReversedIntegerRange<T> inclusiveDownrange(T from, T to) {
return ReversedIntegerRange<T>(from + 1, to);
}
#include <algorithm>
#include <vector>
template <typename R>
void sort(R& range) {
std::sort(range.begin(), range.end());
}
template <typename R, typename Comp>
void sort(R& range, Comp comp) {
std::sort(range.begin(), range.end(), comp);
}
template <typename R>
void reverse(R& range) {
std::reverse(range.begin(), range.end());
}
template <typename R, typename T>
auto lower_bound(const R& range, const T& value) -> decltype(range.begin()) {
return std::lower_bound(range.begin(), range.end(), value);
}
template <typename R, typename T, typename Comp>
auto lower_bound(const R& range, const T& value, Comp comp) -> decltype(range.begin()) {
return std::lower_bound(range.begin(), range.end(), value, comp);
}
template <typename R, typename T>
auto upper_bound(const R& range, const T& value) -> decltype(range.begin()) {
return std::upper_bound(range.begin(), range.end(), value);
}
template <typename R, typename T, typename Comp>
auto upper_bound(const R& range, const T& value, Comp comp) -> decltype(range.begin()) {
return std::upper_bound(range.begin(), range.end(), value, comp);
}
template <typename R>
auto min_element(const R& range) -> decltype(range.begin()) {
return std::min_element(range.begin(), range.end());
}
template <typename R>
auto max_element(const R& range) -> decltype(range.begin()) {
return std::max_element(range.begin(), range.end());
}
template <typename R>
bool next_permutation(R& range) {
return std::next_permutation(range.begin(), range.end());
}
template <typename T>
void unique(std::vector<T>& range) {
range.erase(std::unique(range.begin(), range.end()), range.end());
}
template <typename R>
R sorted(R range) {
sort(range);
return range;
}
template <typename R, typename Comp>
R sorted(R range, Comp comp) {
sort(range, comp);
return range;
}
template <typename R>
R reversed(R range) {
reverse(range);
return range;
}
using namespace std;
class TaskD {
public:
void solve(std::istream& in, std::ostream& out) {
int n, m;
in >> n >> m;
vector<vector<int>> v(n);
for (int i: range(n)) {
int x;
in >> x;
v[x % m].push_back(x);
}
int64_t ans = 0;
ans += v[0].size() / 2;
if (m % 2 == 0) {
ans += v[m / 2].size() / 2;
}
for (int i = 1; i * 2 < m; ++i) {
ans += min(v[i].size(), v[m - i].size());
if (v[i].size() > v[m - i].size()) {
ans += cnt(v[i], v[i].size() - v[m - i].size());
} else {
ans += cnt(v[m - i], v[m - i].size() - v[i].size());
}
}
out << ans << "\n";
}
int64_t cnt(vector<int>& v, int x) {
sort(v);
int64_t ans = 0;
for (int i = 0; i + 1 < (int)v.size();) {
if (v[i] == v[i + 1]) {
i = i + 2;
++ans;
} else {
i = i + 1;
}
}
//cerr << x << ' ' << ans << endl;
return min(x / 2LL, ans);
}
};
int main() {
std::ios_base::sync_with_stdio(false);
TaskD solver;
std::istream& in(std::cin);
std::ostream& out(std::cout);
in.tie(nullptr);
out << std::fixed;
out.precision(20);
solver.solve(in, out);
return 0;
}
| a.cc:47:36: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator' is deprecated [-Wdeprecated-declarations]
47 | class IntegerIterator: public std::iterator<std::input_iterator_tag, T, std::ptrdiff_t, T*, T> {
| ^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
from /usr/include/c++/14/string:47,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:7:
/usr/include/c++/14/bits/stl_iterator_base_types.h:127:34: note: declared here
127 | struct _GLIBCXX17_DEPRECATED iterator
| ^~~~~~~~
a.cc: In member function 'int64_t TaskD::cnt(std::vector<int>&, int)':
a.cc:296:27: error: no matching function for call to 'min(long long int, int64_t&)'
296 | return min(x / 2LL, ans);
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:296:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'})
296 | return min(x / 2LL, ans);
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:174:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:296:27: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
296 | return min(x / 2LL, ans);
| ~~~^~~~~~~~~~~~~~
|
s366932851 | p03913 | C++ | #include<bits/stdc++.h>
//using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb emplace_back
#define mp std::make_pair
//#define endl "\n"
//
using std::endl;
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
//constexpr ll MOD=1e9+7;
//
constexpr ll MOD=998244353;
//constexpr ll MOD=10000000;
//constexpr ll MOD=1e4;
//constexpr ll MOD=1e5;
constexpr ll MAX=3e6;
constexpr ll inf=(1ll<<60);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template<typename T>
struct Segment_tree{
ll N;
T mem;
vector<T> node;
Segment_tree(vector<T> &X,T m):mem(m){
ll sz=X.size();
N=1;
while(N<sz) N*=2;
node.resize(2*N-1,mem);
rep(i,0,sz) node[N-1+i]=X[i];
per(i,N-2,0){
node[i]=Compare(node[i*2+1],node[i*2+2]);
}
}
T Compare(T &A,T &B){
return std::max(A,B);
}
void update(ll X,T val){
X+=N-1;
node[X]=val;
while(X>0){
X=(X-1)/2;
node[X]=Compare(node[X*2+1],node[X*2+2]);
}
}
T Query(ll a,ll b,ll now,ll l,ll r){ //[a,b),[l,r)
if(r<0) r=N;
if(r<=a||b<=l) return mem;
if(a<=l&&r<=b) return node[now];
auto vl=Query(a,b,now*2+1,l,(l+r)/2),vr=Query(a,b,now*2+2,(l+r)/2,r);
return Compare(vl,vr);
}
};
template<typename T>
struct lazy_Segment_tree{
int N;
vector<T> node,lazy;
T INF;
vector<bool> flag;
lazy_Segment_tree(vector<T> X,T Y):INF(Y){
N=1;
while(X.size()>N) N*=2;
node.resize(2*N-1,Y);
lazy.resize(2*N-1);
flag.resize(2*N-1);
rep(i,0,X.size()) node[i+N-1]=X[i];
per(i,N-2,0) node[i]=compare(node[i*2+1],node[i*2+2]);
}
T compare(T X,T Y){
return std::max(X,Y);
}
T plus(T X,int l,int r){
return X;
}
void eval(int now,int l,int r){
if(flag[now]){
if(r-l>1){
flag[now*2+1]=flag[now*2+2]=1;
lazy[now*2+1]=lazy[now*2+2]=lazy[now];
}
node[now]=lazy[now];
flag[now]=0;
}
}
void update(int a,int b,T add,int now=0,int l=0,int r=-1){
if(r<0) r=N;
eval(now,l,r);
if(b<=l||r<=a) return;
if(a<=l&&r<=b){
lazy[now]=add;
flag[now]=1;
eval(now,l,r);
}
else{
update(a,b,add,now*2+1,l,(r+l)/2);
update(a,b,add,now*2+2,(r+l)/2,r);
node[now]=compare(node[now*2+1],node[now*2+2]);
}
}
T Query(int a,int b,int now=0,int l=0,int r=-1){
if(r<0) r=N;
eval(now,l,r);
if(b<=l||r<=a) return INF;
if(a<=l&&r<=b) return node[now];
return compare(Query(a,b,now*2+1,l,(r+l)/2),Query(a,b,now*2+2,(r+l)/2,r));
}
int lower_bound(T val,int now=0,int l=0,int r=-1){
if(r<0){
r=N;
}
eval(now,l,r);
if(node[now]<=val) return r;
if(r-l<=1){
if(node[now]<=val) return r;
return l;
}
int ml=lower_bound(val,now*2+1,l,(l+r)/2);
if(ml==(l+r)/2) return lower_bound(val,now*2+2,(l+r)/2,r);
else return ml;
}
};
struct Strongly_Connected_Components{
ll N,M;
vii edge,revedge;
vi ind;
Strongly_Connected_Components(vii E):edge(E){
N=edge.size();
M=0;
ind.resize(N);
rep(i,0,N){
M+=edge[i].size();
for(auto p:edge[i]) revedge[p].pb(i);
}
vi num(N,-1);
ll cnt=0;
rep(i,0,N){
if(num[i]==-1) dfs(num,i,cnt);
}
vi mem(N);
rep(i,0,N) mem[num[i]]=i;
}
void dfs(vi &num,ll now,ll &cnt){
for(auto p:edge[now]){
if(num[p]==-1) dfs(num,p,cnt);
}
num[now]=cnt++;
}
};
struct Tree{
int N;
vii dp;
vi dist;
Tree(vii edge){
N=edge.size();
dp.resize(N);
dist.resize(N,-1);
for(int i=0;i<N;i++) dp[i].resize(30);
dist[0]=dp[0][0]=0;
std::queue<int> que;
que.push(0);
while(!que.empty()){
int now=que.front(); que.pop();
for(int i=0;i<edge[now].size();i++){
int next=edge[now][i];
if(dist[next]==-1){
dist[next]=dist[now]+1;
que.push(next);
dp[next][0]=now;
}
}
}
for(int i=1;i<30;i++){
for(int j=0;j<N;j++) dp[j][i]=dp[dp[j][i-1]][i-1];
}
}
int LCA(int X,int Y){
if(dist[X]<dist[Y]) std::swap(X,Y);
{
int Z=dist[X]-dist[Y];
for(int i=0;i<30;i++){
if(Z&(1<<i)){
X=dp[X][i];
}
}
}
if(X==Y) return X;
for(int i=29;i>=0;i--){
if(dp[X][i]!=dp[Y][i]){
X=dp[X][i];
Y=dp[Y][i];
}
}
return dp[X][0];
}
};
struct Binary_indexed_tree{
int N;
vi bit;
Binary_indexed_tree(int n):N(n){
bit.resize(N+1,0);
}
void add(int x,ll a){
for(x;x<=N;x+=(x&-x)) bit[x]+=a;
}
ll sum(int x){
ll ret=0;
for(x;x>0;x-=(x&-x)) ret+=bit[x];
return ret;
}
ll lower_bound(ll X){
if(sum(N)<X) return -1;
ll ret=0,memo=1,sum=0;
while(memo*2<=N) memo*=2;
while(memo>0){
if(memo+ret<=N&&sum+bit[memo+ret]<X){
sum+=bit[memo+ret];
ret+=memo;
}
memo/=2;
}
return ret+1;
}
};
struct Union_Find{
ll N;
vi par;
vi siz;
Union_Find(int n):N(n){
par.resize(N);
siz.resize(N,1);
rep(i,0,N) par[i]=i;
}
ll root(ll X){
if(par[X]==X) return X;
return par[X]=root(par[X]);
}
bool same(ll X,ll Y){
return root(X)==root(Y);
}
void unite(ll X,ll Y){
X=root(X);
Y=root(Y);
if(X==Y) return;
par[X]=Y;
siz[Y]+=siz[X];
siz[X]=0;
}
ll size(ll X){
return siz[root(X)];
}
};
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
vi fac,finv,inv;
void COMinit() {
fac.resize(MAX);
finv.resize(MAX);
inv.resize(MAX);
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll COM(ll n,ll r){
if(n<r||n<0||r<0) return 0;
return fac[n]*finv[r]%MOD*finv[n-r]%MOD;
}
void comp(vi &A){
std::map<ll,ll> memo;
rep(i,0,A.size()) memo[A[i]]=0;
ll cnt=1;
for(auto &p:memo) p.second=cnt++;
rep(i,0,A.size()) A[i]=memo[A[i]];
}
void dec(std::map<ll,ll> &mem,ll X){
mem[X]--;
if(mem[X]==0) mem.erase(X);
}
ll mem[2e6][45];
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::random_device rnd;
std::mt19937 mt(rnd());
ll N; cin>>N;
ll A; cin>>A;
ll M=sqrt(N)+1000;
REP(i,1,M){
mem[i][0]=1;
rep(j,1,45){
mem[i][j]=std::min(mem[i][j-1]*i,N+1);
}
}
vi now(45,M);
ll ans=N;
REP(i,1,M){
ans=std::min(ans,i+(N+i-1)/i+A);
rep(j,1,45){
for(;now[j]>=1;now[j]--){
if(mem[now[j]][j]*i<N){
ans=std::min(ans,i+now[j]*j+A*j+A+(N+i*mem[now[j]][j]-1)/(i*mem[now[j]][j]));
now[j]=std::min(M,now[j]+1);
break;
}
ans=std::min(ans,now[j]*j+i+A*j);
ans=std::min(ans,i+A*j+now[j]*(j-1)+(N+mem[now[j]][j]/now[j]*i-1)/(mem[now[j]][j]/now[j]*i));
}
}
}
cout<<ans<<endl;
}
| a.cc:309:8: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
309 | ll mem[2e6][45];
| ^~~
a.cc:309:8: error: could not convert '2.0e+6' from 'double' to 'long unsigned int'
309 | ll mem[2e6][45];
| ^~~
| |
| double
a.cc:309:8: error: size of array 'mem' has non-integral type 'double'
|
s065336525 | p03913 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#define pb push_back
#define int long long
#define ld long double
using namespace std;
const int M = 1000000007;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, a;
cin >> n >> a;
__int128 ANS = n + a;
for (int x = 2; x <= min(n, 2e6); x++) {
int p = 1;
int lol = 0;
while (p <= n) {
int rest = (n + p - 1) / p;
int kek = 0;
int heh = 1;
while (heh < rest) {
heh *= x;
kek++;
}
__int128 bruh = x * kek + (x - 1) * lol + a * (kek + lol);
ANS = min(ANS, bruh);
p *= (x - 1);
lol++;
if (x == 2) break;
}
}
ANS -= a;
cout << (int) ANS << '\n';
} | a.cc: In function 'int main()':
a.cc:34:29: error: no matching function for call to 'min(long long int&, double)'
34 | for (int x = 2; x <= min(n, 2e6); x++) {
| ~~~^~~~~~~~
In file included 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,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:34:29: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
34 | for (int x = 2; x <= min(n, 2e6); x++) {
| ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:34:29: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
34 | for (int x = 2; x <= min(n, 2e6); x++) {
| ~~~^~~~~~~~
|
s290710528 | p03913 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t n, a;
cin >> n >> a;
int64_t ans = n;
auto Solve = [&](int k) {
if (1.0 * (k - 1) * a > ans) return n;
int64_t res = (k - 1) * a;
int64_t d = 2;
while (true) {
double f = 1.0;
int64_t e = 1;
for (int i = 0; i < k; ++i) {
f *= d;
e *= d;
}
if (f < n && e < n) d++;
else break;
}
vector<int64_t> cd;
for (int i = -2; i <= 2; ++i) {
if (d + i >= 2) cd.push_back(d + i);
}
function<int64_t(int, int64_t)> Dfs = [&](int i, int64_t p) {
if (p >= n) return 0LL;
if (i == cd.size()) return n;
int64_t res = n, sum = 0;
while (p <= n) {
res = min(res, sum + Dfs(i + 1, p));
if (1.0 * p * cd[i] > n + n) break;
p *= cd[i];
sum += cd[i];
}
return res;
};
int64_t t = Dfs(0, 1);
return res + t;
};
for (int k = 2; (1LL << k) <= n; ++k) ans = min(ans, Solve(k));
cout << ans << "\n";
return 0;
}
| a.cc: In lambda function:
a.cc:30:40: error: inconsistent types 'long long int' and 'long int' deduced for lambda return type
30 | if (i == cd.size()) return n;
| ^
a.cc:38:20: error: inconsistent types 'long long int' and 'long int' deduced for lambda return type
38 | return res;
| ^~~
|
s087748893 | p03913 | C++ | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> struct ConvexHullTrick {
struct Line { T a, b; };
deque<Line> deq;
bool monotone_query;
bool need(const Line& l, const Line& m, const Line& r) const {
return m.b * (r.a - l.a) > l.b * (r.a - m.a) + r.b * (m.a - l.a);
}
ConvexHullTrick(bool monotone_query = false) : monotone_query(monotone_query) {}
void add(T a, T b) {
if (deq.empty() or a < deq[0].a) {
while (deq.size() >= 2 and !need({a, b}, deq[0], deq[1])) {
deq.pop_front();
}
deq.emplace_front(Line{a, b});
} else if (a > deq.back().a) {
while (deq.size() >= 2 and !need(deq[deq.size() - 2], deq.back(), {a, b})) {
deq.pop_back();
}
deq.emplace_back(Line{a, b});
} else assert(false);
}
T max(T x) {
if (deq.empty()) return numeric_limits<T>::min(); // オーバーフローに注意
if (monotone_query) {
while (deq.size() >= 2 and deq[0].a * x + deq[0].b <= deq[1].a * x + deq[1].b) {
deq.pop_front();
}
return deq[0].a * x + deq[0].b;
}
int ok = 0, ng = deq.size();
while (ng - ok > 1) {
int m = ok + ng >> 1;
(deq[m - 1].a * x + deq[m - 1].b <= deq[m].a * x + deq[m].b ? ok : ng) = m;
}
return deq[ok].a * x + deq[ok].b;
}
};
int main() {
cin.tie(nullptr); ios::sync_with_stdio(false);
lint n, a; cin >> n >> a;
if (a < 2e6) {
V<lint> dp;
ConvexHullTrick<__int128> cht(true);
for (int x = 0; ; ++x) {
dp.push_back(x);
if (a + 2 < x) {
cht.add(dp[x - 1 - a], (1 - x) * dp[x - 1 - a]);
dp[x] = max(dp[x], cht.max(x));
}
if (dp[x] >= n) {
cout << x << '\n';
return 0;
}
}
}
lint res = n;
for (lint x = sqrt(n) - 2; x <= sqrt(n) + 2; ++x) {
if (x < 2 or x >= n) continue;
res = min(res, x + a + (n + x - 1) / x);
}
cout << res << '\n';
} | a.cc: In function 'int main()':
a.cc:55:20: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, __int128)'
55 | dp[x] = max(dp[x], cht.max(x));
| ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:55:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__int128')
55 | dp[x] = max(dp[x], cht.max(x));
| ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:55:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
55 | dp[x] = max(dp[x], cht.max(x));
| ~~~^~~~~~~~~~~~~~~~~~~
|
s752262816 | p03913 | C++ | #include <cstdio>
#include <cmath>
typedef long long signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(int i = (l) ; i < (r); i++)
#define incII(i, l, r) for(int i = (l) ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r) ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) < (r))
template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
// ---- ----
LL n, a;
LL dp[2000000];
int main() {
scanf("%lld%lld", &n, &a);
if(n > 1000000 || a > 1000000) { return 1; }
inc(i, n) { dp[i] = i; }
incID(i, 2, n) {
int t = dp[i];
incII(j, 2, n) {
setmin(dp[i * j], t + a + j);
if(s * j >= n) { break; }
}
}
LL mi = n;
incID(i, n, 2 * n) { setmin(mi, dp[i]); }
printf("%lld\n", mi);
return 0;
}
| a.cc: In function 'int main()':
a.cc:42:28: error: 's' was not declared in this scope
42 | if(s * j >= n) { break; }
| ^
|
s399433697 | p03913 | C++ | #include <cstdio>
#include <cmath>
typedef long long signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(int i = (l) ; i < (r); i++)
#define incII(i, l, r) for(int i = (l) ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r) ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) < (r))
template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
// ---- ----
LL n, a;
int dp[2000000];
int main() {
scanf("%lld%lld", &n, &a);
if(n > 1000000 || a > 1000000) { return -1; }
inc(i, n) { dp[i] = i; }
incID(i, 2, n) {
int s = dp[i];
incII(j, 2, n) {
setmin(dp[s * j], i + a + j);
if(s * j >= n) { break; }
}
}
int mi = n;
incID(i, n, 2 * n) { setmin(mi, dp[i]); }
printf("%d\n", mi);
return 0;
}
| a.cc: In function 'int main()':
a.cc:41:31: error: no matching function for call to 'setmin(int&, LL)'
41 | setmin(dp[s * j], i + a + j);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:23:27: note: candidate: 'template<class T> bool setmin(T&, T)'
23 | template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
| ^~~~~~
a.cc:23:27: note: template argument deduction/substitution failed:
a.cc:41:31: note: deduced conflicting types for parameter 'T' ('int' and 'long long int')
41 | setmin(dp[s * j], i + a + j);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
|
s319575716 | p03913 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
const int INF = (int)1e18;
vector<int> div(int n) {
vector<int> ret;
for(int i = 1; i * i <= n; ++i) {
if(n % i == 0) {
ret.push_back(i);
if(i * i != n) {
ret.push_back(n / i);
}
}
}
sort(ret.begin(), ret.end());
return ret;
}
int N, A;
map<int, int> memo;
int solve(int n) {
if(memo.count(n)) return memo[n];
vector<int> v = div(n);
int ret = INF;
for(int k : v) {
if(k == n) continue;
ret = min(ret, solve(k) + n / k + A);
}
// cerr << "solve(" << n << ")=" << ret << endl;
return memo[n] = ret;
}
typedef pair<int, int> P;
struct Node {
int x, a, d;
Node(int x_, int a_, int d_) : x(x_), a(a_), d(d_) {}
bool operator <(const Node& other) const {
return d > other.d;
}
};
signed main() {
ios::sync_with_stdio(false);
cin >> N >> A;
if(false) {
// if(N <= 1000000 && A <= 1000000) {
vector<int> start(N + 1, INF);
start[1] = 0;
int ans = INF;
for(int a = 1; a <= N; ++a) {
// cerr << "start[" << a << "]=" << start[a] << endl;
if(ans > start[a] + (N + a - 1) / a) {
// cerr << "target a=" << a << endl;
}
ans = min(ans, start[a] + (N + a - 1) / a);
for(int j = 1; a * j <= N; ++j) {
start[a * j] = min(start[a * j], start[a] + j + A);
}
}
cout << ans << endl;
}
else {
// int ans = INF;
// vector<int> v = div(N);
// memo[1] = 0;
// for(int k : v) {
// ans = min(ans, solve(k) + N / k);
// }
// cout << ans << endl;
int ans = INF;
priority_queue<Node> Q;
Q.emplace(0, 1, 0);
map<P, int> D;
D[P(0, 1)] = 0;
while(!Q.empty()) {
Node p = Q.top(); Q.pop();
if(p.d >= ans) break;
ans = min(ans, (N - p.x + p.a - 1) / p.a + p.d);
if(p.d + A + (N + p.x - 1) / max(p.x, 1) <= ans) {
if(D.count(P(p.x + p.a, p.a)) == false || D[P(p.x + p.a, p.a)] > p.d + 1) {
D[P(p.x + p.a, p.a)] = p.d + 1;
Q.emplace(p.x + p.a, p.a, p.d + 1);
}
if(D.count(P(0, p.x)) == false || D[P(0, p.x)] > p.d + A) {
D[P(0, p.x)] = p.d + A;
Q.emplace(0, p.x, p.d + A);
}
}
}
cout << ans << endl;
}
}
| a.cc: In function 'int main()':
a.cc:78:39: error: no matching function for call to 'max(long long int&, int)'
78 | if(p.d + A + (N + p.x - 1) / max(p.x, 1) <= ans) {
| ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:78:39: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
78 | if(p.d + A + (N + p.x - 1) / max(p.x, 1) <= ans) {
| ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:78:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
78 | if(p.d + A + (N + p.x - 1) / max(p.x, 1) <= ans) {
| ~~~^~~~~~~~
|
s770488400 | p03913 | C++ | #include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define SREP(s,i,m) for(unsigned int i = s; i < m; ++i)
#define REP(i,m) SREP(0,i,m)
using namespace std;
#ifdef _MSC_VER
using LONG = __int64;
using ULONG = unsigned __int64;
#else
using LONG = long long int;
using ULONG = unsigned long long int;
#endif
// 二乗を計算する。
int sq(int x) { return x * x; }
int main(void) {
ULONG N, A;
cin >> N >> A;
vector<ULONG> D(N + 1);
D[1] = ULLONG_MAX;
for (ULONG i = 2; i <= N; i++) {
ULONG best = -1;
for (LONG j = 1; j < i; j++) {
ULONG t = D[j] + (i + j - 1) / j + A;
best = min(t, best);
}
D[i] = best;
}
cout << D[N] << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:30:10: error: 'ULLONG_MAX' was not declared in this scope
30 | D[1] = ULLONG_MAX;
| ^~~~~~~~~~
a.cc:10:1: note: 'ULLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
9 | #include <stack>
+++ |+#include <climits>
10 | #include <string>
|
s318858138 | p03913 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = numeric_limits<ll>::max() / 2;
ll dp[1000100];
int main(void){
fill(dp,dp+1000100,inf);
dp[1] = 0;
ll n,a;
cin >> n >> a;
if(n > pow(10,6)) return 0;
for(ll i = 1;i <= n;++i){
ll j = 1;
while(i*j <= n){
dp[i*j] = min(dp[i*j],dp[i]+j+a);
++j;
}
}
ll res = inf;
for(ll i = 1;i < n;++i){
res = min(res,dp[i] + (ll)ceil(n/(double)i));
}
cout << min(res) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:14: error: no matching function for call to 'min(ll&)'
25 | cout << min(res) << endl;
| ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed:
a.cc:25:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
25 | cout << min(res) << endl;
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
|
s067117268 | p03913 | C++ | #include <iostream>
using namespace std;
int main(void)
{
long long int N, A;
cin >> N >> A;
long long int dp[40];
dp[0] = 0;
for (long long int i = 1; i < 40; i++) {
dp[i] = LONG_MAX;
for (int j = 0; j < i; j++)
dp[i] = min(dp[i], dp[j] + (1L << (i - j)) + A);
//cout << i << " " << dp[i] << endl;
}
long long int res = LONG_MAX, cnt;
for (long long int i = 0; i < 40; i++) {
cnt = dp[i] + N / (1L << i);
if (N % (1 << i))
cnt++;
//cout << i << " " << cnt << endl;
res = min(res, cnt);
}
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'LONG_MAX' was not declared in this scope
13 | dp[i] = LONG_MAX;
| ^~~~~~~~
a.cc:2:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 | using namespace std;
a.cc:19:25: error: 'LONG_MAX' was not declared in this scope
19 | long long int res = LONG_MAX, cnt;
| ^~~~~~~~
a.cc:19:25: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:21:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
21 | cnt = dp[i] + N / (1L << i);
| ^~~
| int
|
s063179610 | p03913 | C++ | #include <bits/stdc++.h>
using namespace std;
//int dp[2][1000010];
//vector<int> dp1(1000010);
//vector<int> dp2(1000010);
//vector<int> dp3(1000010);
int main(){
long long int N,A;
cin>>N>>A;
//cout<<m[make_pair(1,1)]<<endl;
if(N <= A){
cout<<N<<endl;
return 0;
}
if(N >= 1000010 || A >= 1000010){
return 0;
}
/*
map<pair<int,int>,int> m2;
m2[make_pair(A,1)] = A;
for(int i=A+1;i<=A;i++){
}
*/
//priority_queue<pair<pair<int,int>,int> > que;
//time num/s total
map<long long int,map<long long int,long long int> > m;
m[A][1] = A;
//que.push(make_pair(make_pair(A,1),A));
for(long long int i=A;;;i++){
for(auto &kv : m[i]){
if(kv.second >= N){
cout<<i<<endl;
return 0;
}
m[i+1][kv.first] = max(m[i+1][kv.first],kv.second + kv.first);
if(kv.second > kv.first){
m[i+A+1][kv.second] = max(m[i+A+1][kv.second],kv.second);
}
//cout<<kv.first<<endl;
}
/*
t = q.first.first;
n = q.first.second;
num = q.second;
if(q.first.first >= N){
cout<<min(res,N)<<endl;
return 0;
}
que.push(make_pair(make_pair(t+1,n),num+n));
que.push(make_pair())
*/
}
/*
memset(dp,-1,sizeof(dp));
dp[1][1] = 1;
for(int i=2;i<=N;i++){
for(int j=1;j<=1000000;j++){
if(i > A){
for(int k=0;k<j;k++){
if(dp[i-A][k] == j){
dp[i][j] = 0;
break;
}
}
}
if(dp[i-1][j] != -1){
dp[i][j] = max(dp[i-1][j] + j,dp[i][j]);
}
if(dp[i][j] >= N){
cout<<i<<endl;
return 0;
}
}
}
*/
} | a.cc: In function 'int main()':
a.cc:33:32: error: expected primary-expression before ';' token
33 | for(long long int i=A;;;i++){
| ^
a.cc:33:32: error: expected ')' before ';' token
33 | for(long long int i=A;;;i++){
| ~ ^
| )
a.cc:33:33: error: 'i' was not declared in this scope
33 | for(long long int i=A;;;i++){
| ^
|
s207385674 | p03913 | C++ | #include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
using namespace std;
long long power(long long n, long long p) {
if (p == 0)
return 1;
long long res = 1;
long long add = n;
while (p > 0) {
if (p & 1)
res = (res * add);
p >>= 1;
add = add*add;
}
return res;
}
bool check(long long T, long long N, long long a) {
// division
long long div;
if (a == 0)
div = T;
else
div = T / a;
FOR(k, 1, div) {
// mはT未満
// rはk未満(T未満)
long long m = (T - (k - 1)*a) / k;
long long r = (T - (k - 1)*a) % k;
if (m == 0)
continue;
// (m+1)をr回、mをk-r回かける
// でかすぎ
double exper = pow(m, k - r) * pow(m + 1, r);
assert(!isinf<double>(exper));
if (exper > N) {
return true;
}
long long res = power(m, k - r) * power(m + 1, r);
if (res >= N)
return true;
}
return false;
}
int main() {
long long n, a;
cin >> n >> a;
long long lb = 0, ub = n;
while (ub - lb > 1) {
long long half = (lb + ub) / 2;
if (check(half, n, a)) {
ub = half;
}
else {
lb = half;
}
}
cout << ub << endl;
return 0;
} | In file included from /usr/include/c++/14/cassert:44,
from a.cc:21:
a.cc: In function 'bool check(long long int, long long int, long long int)':
a.cc:62:38: error: no matching function for call to 'isinf<double>(double&)'
62 | assert(!isinf<double>(exper));
| ~~~~~~~~~~~~~^~~~~~~
In file included from a.cc:15:
/usr/include/c++/14/cmath:1169:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, bool>::__type std::isinf(_Tp)'
1169 | isinf(_Tp)
| ^~~~~
/usr/include/c++/14/cmath:1169:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/cmath: In substitution of 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, bool>::__type std::isinf(_Tp) [with _Tp = double]':
a.cc:62:3: required from here
62 | assert(!isinf<double>(exper));
| ~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/cmath:1169:5: error: no type named '__type' in 'struct __gnu_cxx::__enable_if<false, bool>'
1169 | isinf(_Tp)
| ^~~~~
a.cc:62:38: note: some candidates omitted; use '-fdiagnostics-all-candidates' to display them
62 | assert(!isinf<double>(exper));
| ~~~~~~~~~~~~~^~~~~~~
|
s962218879 | p03913 | C++ | #pragma GCC optimize("O3")
#pragma GCC target("sse4.2")
#include <vector>
#include <queue>
#include <unordered_map>
#include <tuple>
#include <cstdio>
#include <cmath>
using namespace std;
namespace std{
template<typename T>
inline void hash_combine(size_t& seed, T const& v){
seed ^= hash<T>()(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
template<typename It>
inline size_t hash_range(It first, It last){
size_t seed=0;
hash_range(seed,first,last);
return seed;
}
template<typename It>
inline void hash_range(size_t& seed, It first, It last){
for(;first!=last;++first)hash_combine(seed, *first);
}
template<typename A,typename B>
class hash<pair<A,B>>{
public:
size_t operator()(pair<A,B> const &p) const{
size_t seed=0;
hash_combine(seed,p.first);
hash_combine(seed,p.second);
return seed;
}
};
}
int main(){
long long N,A,R;
scanf("%lld%lld",&N,&A);R=N;
if(N>1000000)return 1;
//if(N>100000)R=sqrt(R);
unordered_map<pair<long long,long long>,long long>m; //m<n,speed>=time
m[{0,1}]=0;
queue<tuple<long long,long long,long long> >q;
q.push(make_tuple(0,0,1));
for(;!q.empty();){
auto cur=q.top();q.pop();
long long time=-get<0>(cur);
long long n=get<1>(cur);
long long speed=get<2>(cur);
if(time>=R)continue;
vector<tuple<int,int,int>> nxt={
make_tuple(0,n,time+A),
make_tuple(n+speed,speed,time+1)
};
for(auto &e:nxt){
long long nxtn=get<0>(e);
long long nxtspeed=get<1>(e);
long long nxttime=get<2>(e);
if(nxtn>=N){
R=min(R,nxttime);
}else if(nxttime<R && (m.find({nxtn,nxtspeed})==m.end()||m[{nxtn,nxtspeed}]>nxttime)){
m[{nxtn,nxtspeed}]=nxttime;
q.push(make_tuple(-nxttime,nxtn,nxtspeed));
}
}
}
printf("%lld\n",R);
} | a.cc: In function 'int main()':
a.cc:50:28: error: 'class std::queue<std::tuple<long long int, long long int, long long int> >' has no member named 'top'; did you mean 'pop'?
50 | auto cur=q.top();q.pop();
| ^~~
| pop
|
s962580653 | p03913 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n,a;cin>>n>>a;
if(n>DEBUG||a>DEBUG||n<=a) {
cout << n << endl;
return 0;
}
ll i,j,k=0,l,ans=n;
for(i=1;i<=n;i*=2){
for(l=1;l<=a;l++){
j=l*i;
ans=min(ans,l+k*(1+a)+(n-1)/j+1);
}
k++;
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:8: error: 'DEBUG' was not declared in this scope
6 | if(n>DEBUG||a>DEBUG||n<=a) {
| ^~~~~
|
s137374937 | p03913 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
template< class T >
struct ConvexHullTrick
{
struct Fraction
{
T a, b;
Fraction(T a, T b) : a(a), b(b)
{
if(b < 0) a *= -1, b *= -1;
}
bool operator<(const Fraction &r) const
{
return a * r.b < r.a * b;
}
};
struct Line
{
T a, b;
Line(T a, T b) : a(a), b(b) {}
T operator()(T x) const
{
return a * x + b;
}
bool operator<(const Line &r) const
{
return a != r.a ? a < r.a : b < r.b;
}
};
set< Line > ls;
set< pair< Fraction, Line>> ip;
ConvexHullTrick()
{
ls.emplace(numeric_limits< T >::min(), 0);
}
Fraction intersection(Line l1, Line l2)
{
return Fraction(-(l2.b - l1.b), l2.a - l1.a);
}
bool need(Line l1, Line l2, Line l3)
{
return intersection(l1, l2) < intersection(l2, l3);
}
void add(T a, T b)
{
Line c(a, b);
auto r = ls.lower_bound(c);
auto l = prev(r);
if(l != ls.begin() && r != ls.end()) {
if(need(*l, c, *r)) {
ip.erase(make_pair(intersection(*l, *r), *l));
} else return;
}
while(l != ls.begin() && prev(l) != ls.begin() && !need(*prev(l), *l, c)) {
ip.erase(make_pair(intersection(*prev(l), *l), *prev(l)));
ls.erase(l--);
}
while(r != ls.end() && next(r) != ls.end() && !need(c, *r, *next(r))) {
ip.erase(make_pair(intersection(*r, *next(r)), *r));
ls.erase(r++);
}
if(l != ls.begin()) {
ip.emplace(intersection(*l, c), *l);
}
if(r != ls.end()) {
ip.emplace(intersection(c, *r), c);
}
ls.emplace(c);
}
T maximum(T x)
{
auto it = ip.lower_bound(make_pair(Fraction(x, 1), Line(numeric_limits< T >::min(), numeric_limits< T >::min())));
Line l = it != ip.end() ? it->second : *ls.rbegin();
return l(x);
}
};
const int INF = 1 << 30;
int N, A;
signed main()
{
cin >> N >> A;
if(N == 1) {
cout << 1 << endl;
return (0);
}
if(N <= A) {
cout << N << endl;
return (0);
}
dp1[0] = 0;
dp1[1] = 1;
dp2[1] = 1;
ConvexHullTrick< long long > cht;
cht.add(1, 0);
map< int, int > con;
for(int j = 2; true; j++) {
dp1[j] = cht.maximum(j);
if(dp1[j] >= N) {
cout << j << endl;
return (0);
}
if(j - A >= 0) {
int val = cht.maximum(j - A);
cht.add(val, -val * j);
}
}
}
| a.cc: In function 'int main()':
a.cc:112:3: error: 'dp1' was not declared in this scope
112 | dp1[0] = 0;
| ^~~
a.cc:114:3: error: 'dp2' was not declared in this scope; did you mean 'dup2'?
114 | dp2[1] = 1;
| ^~~
| dup2
|
s395389129 | p03913 | C++ | #include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl
#define N 100000
#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n,a;
int ans;
int dp[1000000];
int main()
{
cin>>n>>a;
rep2(i,2,max((int)(sqrt(n))+1,(int)(sqrt(n))*2+1)))
{
dp[i]=i+a;
rep2(j,1,(int)(sqrt(n))*2+1)
{
if(i%j==0)
{
dp[i]=min(dp[i],dp[j]+i/j+a);
if(j!=1&&j<(i/j))
{
dp[i]=min(dp[i],dp[(i/j)]+j+a);
}
}
}
}
ans=n;
int s;
rep2(i,1,(int)(sqrt(n))*2+1)
{
s=dp[i];
s+=(n/i);
if(n%i!=0)s+=1;
if(ans>s)
{
ans=s;
}
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:59: error: expected primary-expression before ')' token
26 | rep2(i,2,max((int)(sqrt(n))+1,(int)(sqrt(n))*2+1)))
| ^
|
s283965330 | p03913 | C++ | #include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl
#define N 100000
#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n,a;
int ans;
int dp[1000000];
int main()
{
cin>>n>>a;
rep2(i,2,max((int)(sqrt(n))+1,(int)(sqrt(n))*2+1)))
{
dp[i]=i+a;
rep2(j,1,(int)(sqrt(i))+1)
{
if(i%j==0)
{
dp[i]=min(dp[i],dp[j]+i/j+a);
if(j!=1&&j<(i/j))
{
dp[i]=min(dp[i],dp[(i/j)]+j+a);
}
}
}
}
ans=n;
int s;
rep2(i,1,max((int)(sqrt(n))+1,(int)(sqrt(n))*2+1))
{
s=dp[i];
s+=(n/i);
if(n%i!=0)s+=1;
if(ans>s)
{
ans=s;
}
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:59: error: expected primary-expression before ')' token
26 | rep2(i,2,max((int)(sqrt(n))+1,(int)(sqrt(n))*2+1)))
| ^
|
s934855304 | p03913 | C++ | #include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
map<long long,long long>dp;
long long A;
long long calc(long long N){
if(N<=A)return N;
if(dp.count(N)){
return dp[N];
}
long long ret=N;
for(long long i=max(2,sqrt(A)-10);i*i<=N;i++){
ret=min(ret,i+A+calc((N+i-1)/i));
}
return dp[N]=ret;
}
int main(){
long long a,b;
scanf("%lld%lld",&a,&b);
A=b;
printf("%lld\n",calc(a));
} | a.cc: In function 'long long int calc(long long int)':
a.cc:13:31: error: 'sqrt' was not declared in this scope
13 | for(long long i=max(2,sqrt(A)-10);i*i<=N;i++){
| ^~~~
|
s484110250 | p03913 | C++ | #include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#define pb push_back
#define pbk pop_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define foreach(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define len(a) ((int) (a).size())
#ifdef CUTEBMAING
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
using namespace std;
typedef long long int64;
typedef long double ld;
typedef unsigned long long lint;
const int inf = (1 << 30) - 1;
const int64 linf = (1ll << 62) - 1;
const int N = 1e6 + 100;
int64 n, a;
int64 dp[N];
int main() {
#ifdef XCODE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
cin >> n >> a;
vector<int64> dv;
for (int64 i = 1; i * i <= n; i++) {
if (n % i == 0) {
dv.pb(i);
dv.pb(n / i);
}
}
sort(all(dv)), dv.resize(unique(all(dv)) - dv.begin());
fill_n(dp, len(dv), linf);
dp[0] = 0;
for (int i = 0; i < len(dv); i++) {
for (int j = i + 1; j < len(dv); j++) {
if (dv[j] % dv[i] != 0) {
continue;
}
dp[j] = min(dp[j], dp[i] + (dv[j] / dv[i]) + a);
}
}
cout << max(0, dp[len(dv) - 1] - a) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:74:16: error: no matching function for call to 'max(int, int64)'
74 | cout << max(0, dp[len(dv) - 1] - a) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included 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,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:74:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'int64' {aka 'long long int'})
74 | cout << max(0, dp[len(dv) - 1] - a) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:12:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:74:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
74 | cout << max(0, dp[len(dv) - 1] - a) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
|
s456844757 | p03913 | C++ | #pragma GCC optimize("O3")
#pragma GCC target("sse4.2")
#include <vector>
#include <queue>
#include <map>
#include <tuple>
#include <cstdio>
using namespace std;
int main(){
long long N,A,R;
scanf("%lld%lld",&N,&A);R=N;
if(N>1000000)return 1;
if(N>10000)R=sqrt(R);
map<pair<long long,long long>,long long>m; //m<n,speed>=time
m[{0,1}]=0;
priority_queue<tuple<long long,long long,long long> >q;
q.push(make_tuple(0,0,1));
for(;!q.empty();){
auto cur=q.top();q.pop();
long long time=-get<0>(cur);
long long n=get<1>(cur);
long long speed=get<2>(cur);
if(time>=R)continue;
vector<tuple<int,int,int>> nxt={
make_tuple(0,n,time+A),
make_tuple(n+speed,speed,time+1)
};
for(auto &e:nxt){
long long nxtn=get<0>(e);
long long nxtspeed=get<1>(e);
long long nxttime=get<2>(e);
if(nxtn>=N){
R=min(R,nxttime);
}else if(m.find({nxtn,nxtspeed})==m.end()||m[{nxtn,nxtspeed}]>nxttime){
m[{nxtn,nxtspeed}]=nxttime;
q.push(make_tuple(-nxttime,nxtn,nxtspeed));
}
}
}
printf("%lld\n",R);
} | a.cc: In function 'int main()':
a.cc:15:22: error: 'sqrt' was not declared in this scope
15 | if(N>10000)R=sqrt(R);
| ^~~~
|
s157953289 | p03914 | C++ | 瞬殺(昔見たことが有った) | a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token
1 | 瞬殺(昔見たことが有った)
| ^
|
s127281863 | p03914 | C++ | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#define pb push_back
#define mp make_pair
#define taskname "A"
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int maxn = 3e2 + 5;
const int mod = 1e9 + 7;
int f[maxn][maxn][maxn];
int n ,m;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
if(fopen(taskname".INP","r")){
freopen(taskname".INP", "r",stdin);
freopen(taskname".OUT", "w",stdout);
}
cin >> n >> m;
f[0][1][1] = 1;
for(int i = 0 ; i < m ; ++i){
for(int j = 1 ; j <= n ; ++j){
for(int t = 1 ; t <= j ; ++t){
auto add = [&](int & x , int y){
x += y;if(x>=mod)x-=mod;
};
add(f[i + 1][j + 1][t] , (ll)f[i][j][t] * (n - j) % mod);//
add(f[i + 1][j][t] , (ll)f[i][j][t] * (j - t) % mod);
add(f[i + 1][j][j] , (ll)f[i][j][t] * t % mod);
}
}
}
cout << f[m][n][n];
}
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#define pb push_back
#define mp make_pair
#define taskname "A"
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int maxn = 3e2 + 5;
const int mod = 1e9 + 7;
int f[maxn][maxn][maxn];
int n ,m;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
if(fopen(taskname".INP","r")){
freopen(taskname".INP", "r",stdin);
freopen(taskname".OUT", "w",stdout);
}
cin >> n >> m;
f[0][1][1] = 1;
for(int i = 0 ; i < m ; ++i){
for(int j = 1 ; j <= n ; ++j){
for(int t = 1 ; t <= j ; ++t){
auto add = [&](int & x , int y){
x += y;if(x>=mod)x-=mod;
};
add(f[i + 1][j + 1][t] , (ll)f[i][j][t] * (n - j) % mod);//
add(f[i + 1][j][t] , (ll)f[i][j][t] * (j - t) % mod);
add(f[i + 1][j][j] , (ll)f[i][j][t] * t % mod);
}
}
}
cout << f[m][n][n];
}
| a.cc:63:11: error: redefinition of 'const int maxn'
63 | const int maxn = 3e2 + 5;
| ^~~~
a.cc:17:11: note: 'const int maxn' previously defined here
17 | const int maxn = 3e2 + 5;
| ^~~~
a.cc:64:11: error: redefinition of 'const int mod'
64 | const int mod = 1e9 + 7;
| ^~~
a.cc:18:11: note: 'const int mod' previously defined here
18 | const int mod = 1e9 + 7;
| ^~~
a.cc:66:5: error: redefinition of 'int f [305][305][305]'
66 | int f[maxn][maxn][maxn];
| ^
a.cc:20:5: note: 'int f [305][305][305]' previously declared here
20 | int f[maxn][maxn][maxn];
| ^
a.cc:67:5: error: redefinition of 'int n'
67 | int n ,m;
| ^
a.cc:21:5: note: 'int n' previously declared here
21 | int n ,m;
| ^
a.cc:67:8: error: redefinition of 'int m'
67 | int n ,m;
| ^
a.cc:21:8: note: 'int m' previously declared here
21 | int n ,m;
| ^
a.cc:69:5: error: redefinition of 'int main()'
69 | int main()
| ^~~~
a.cc:23:5: note: 'int main()' previously defined here
23 | int main()
| ^~~~
|
s070857292 | p03914 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
class mint{
static const int MOD=1e9+7;
int x;
public:
mint():x(0){}
mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }
mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
mint& operator-=(const mint& m){ x-=m.x; if(x< 0) x+=MOD; return *this; }
mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
mint& operator/=(const mint& m){ return *this*=inverse(m); }
mint operator+(const mint& m)const{ return mint(*this)+=m; }
mint operator-(const mint& m)const{ return mint(*this)-=m; }
mint operator*(const mint& m)const{ return mint(*this)*=m; }
mint operator/(const mint& m)const{ return mint(*this)/=m; }
friend mint inverse(const mint& m){
int a=m.x,b=MOD,u=1,v=0;
while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
return u;
}
friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
int to_int()const{ return x; }
};
mint operator*(long long y,const mint& m){ return m*y; }
int main(){
int n,m; scanf("%d%d",&n,&m);
mint dp[2][301][300]; // dp[頂点 0 を含む強連結成分のサイズ][新たに訪れた部分のサイズ] = 場合の数
dp[0][1][0]=1;
int cur=0,next=1;
rep(t,m){
rep(i,n+1) rep(j,n) dp[next][i][j]=0;
for(int i=1;i<=t+1;i++) rep(j,n-i+1) if(dp[cur][i][j].to_int()!=0) {
dp[next][i+j][0]+=i*dp[cur][i][j]; // 0 を含む強連結成分に移動
dp[next][i][j]+=j*dp[cur][i][j]; // 新たに訪れた j 個の頂点のうちのどれかに移動
dp[next][i][j+1]+=(n-i-j)*dp[cur][i][j]; // 未到達の頂点に移動
}
swap(curr,next);
}
printf("%d\n",dp[curr][n][0].to_int());
return 0;
}
| a.cc: In function 'int main()':
a.cc:50:22: error: 'curr' was not declared in this scope; did you mean 'cur'?
50 | swap(curr,next);
| ^~~~
| cur
a.cc:52:26: error: 'curr' was not declared in this scope; did you mean 'cur'?
52 | printf("%d\n",dp[curr][n][0].to_int());
| ^~~~
| cur
|
s626141972 | p03914 | C++ | #include <bits/stdc++.h>
using namespace std;
int n, m;
int memo[310][310][310];
const int MOD 1000000007
long long dp(int i, int ma, int all){
if(i == m) return ma == n ? 1 : 0;
if(memo[i][ma][all] != -1) return memo[i][ma][all];
return memo[i][ma][all] = (dp(i+1, all, all)*ma%MOD + dp(i+1, ma, all)*(all-ma)%MOD + dp(i+1, ma, all+1)*(n-all)%MOD) % MOD;
}
signed main(){
cin >> n >> m;
memset(memo, -1, sizeof(memo));
cout << dp(0, 1, 1) << endl;
return 0;
} | a.cc:6:15: error: expected initializer before numeric constant
6 | const int MOD 1000000007
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:18:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
18 | cout << dp(0, 1, 1) << endl;
| ^~
| dup
|
s275785303 | p03914 | C++ | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 310
ll dp[N], dp2[N];
int n, m;
ll mod = 1e9+7;
int main(){
cin>>n>>m;
dp[0][0] = 1;
rep(i, m){
memcpy(dp2, dp, sizeof(dp));
mset(dp, 0);
for(int j = 0; j <= n; j++){
if(j<n-1){
(dp[j]+=dp2[j]*(j+1))%=mod;
(dp[j+1]+=dp2[j]*(n-j-1))%=mod;
} else if(j==n-1){
(dp[j]+=dp2[j]*j)%=mod;
(dp[j+1]+=dp2[j])%=mod;
} else if(j==n){
(dp[j]+=dp2[j]*n)%=mod;
}
}
}
cout<<dp[n]<<endl;
return 0;
}
| a.cc:44:4: error: conflicting declaration 'll mod'
44 | ll mod = 1e9+7;
| ^~~
a.cc:27:10: note: previous declaration as 'const ll mod'
27 | const ll mod = 1e9+7;
| ^~~
a.cc: In function 'int main()':
a.cc:48:14: error: invalid types 'll {aka long long int}[int]' for array subscript
48 | dp[0][0] = 1;
| ^
|
s648803580 | p03915 | C++ | #include <iostream>
#include <cctype>
#include <cstdio>
#include <cstring>
using namespace std;
#define M 800005
#define ll long long
int n, q, tot;
int fa[M];
ll ans, d[M];
struct Edge
{ int u, v; ll w; } e[M];
inline int read()
{
int x = 0, f = 1; char ch = getchar();
while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
while (isdigit(ch)) { (x *= 10) += ch - '0'; ch = getchar(); }
return x * f;
}
inline int findf(int x)
{ return fa[x] == x ? x : fa[x] = findf(fa[x]); }
inline bool cmp1(Edge a, Edge b)
{ return a.w < b.w; }
inline void kruscal()
{
sort(e + 1, e + 1 + tot, cmp1);
for (int i = 1; i <= tot; i++)
{
int uf = findf(e[i].u), vf = findf(e[i].v);
if (uf == vf) continue;
fa[uf] = vf; ans += e[i].w;
}
}
int main()
{
n = read(), q = read(); tot = q;
for (int i = 0; i < n; i++) fa[i] = i;
memset(d, 0x3f3f3f3f, sizeof(d));
for (int i = 1; i <= q; i++)
{
e[i].u = read(), e[i].v = read(); e[i].w = read();
d[e[i].u] = min(d[e[i].u], e[i].w + 1);
d[e[i].v] = min(d[e[i].v], e[i].w + 2);
}
for (int i = 0; i < n; i++)
d[i] = min(d[i], d[(i-1+n)%n] + 2);
for (int i = 0; i < n; i++)
d[i] = min(d[i], d[(i-1+n)%n] + 2);
for (int i = 0; i < n; i++)
e[++tot].u = i, e[tot].v = (i+1)%n, e[tot].w = d[i];
kruscal();
cout << ans;
return 0;
} | a.cc: In function 'void kruscal()':
a.cc:34:9: error: 'sort' was not declared in this scope; did you mean 'short'?
34 | sort(e + 1, e + 1 + tot, cmp1);
| ^~~~
| short
|
s621820962 | p03915 | C++ | #include <bits/stdc++.h>
#define MAXN 210000
#define ll long long
#define INF (1<<30)
using namespace std;
ll n,q;
struct data{
ll u,v,w;
}line[MAXN*2];
ll link[MAXN*2];
inline ll read(){
ll x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return x*f;
}
inline bool cmp(data a,data b){
return a.w<b.w;
}
ll fa[MAXN];
ll find(ll x){
if (fa[x]==x)
return x;
return fa[x]=find(fa[x]);
}
int main(){
n=read(),q=read();
for(ll i=0;i<2*n;i++)
link[i]=line[q+i].w=INF;
for(ll i=1;i<=q;i++){
ll a=read(),b=read(),c=read();
line[i].u=a,line[i].v=b,line[i].w=c;
link[a]=min(link[a],c+1);
link[b]=min(link[b],c+2);
}
ll minn=INF;
for(ll i=0;i<2*n-1;i++){
minn+=2;
minn=min(link[i],minn);
line[q+(i%n)+1].u=i%n;
line[q+(i%n)+1].v=(i+1)%n;
line[q+(i%n)+1].w=min(line[q+(i%n)+1].w,minn);
}
sort(line+1,line+1+n+q,cmp);
ll cnt=0,sum=0;
for(int i=0;i<n;i++)
fa[i]=i;
for(ll i=1;cnt<n-1;i++){
ll xf=find(line[i].u),yf=find(line[i].v);
if (xf!=yf){
//cout<<line[i].u<<" "<<line[i].v<<" "<<line[i].w<<endl;
cnt++;
fa[xf]=yf;
sum+=line[i].w;
}
}
cout<<sum;
return 0;
} | a.cc:10:15: error: 'long long int link [420000]' redeclared as different kind of entity
10 | ll link[MAXN*2];
| ^
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
from /usr/include/signal.h:328,
from /usr/include/c++/14/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
from a.cc:1:
/usr/include/unistd.h:819:12: note: previous declaration 'int link(const char*, const char*)'
819 | extern int link (const char *__from, const char *__to)
| ^~~~
a.cc:27:17: error: reference to 'data' is ambiguous
27 | inline bool cmp(data a,data b){
| ^~~~
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:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:8: note: 'struct data'
7 | struct data{
| ^~~~
a.cc:27:24: error: reference to 'data' is ambiguous
27 | inline bool cmp(data a,data b){
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:8: note: 'struct data'
7 | struct data{
| ^~~~
a.cc:27:30: error: expression list treated as compound expression in initializer [-fpermissive]
27 | inline bool cmp(data a,data b){
| ^
a.cc: In function 'int main()':
a.cc:41:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
41 | link[i]=line[q+i].w=INF;
| ^
a.cc:41:24: error: assignment of read-only location '*(link + ((sizetype)i))'
41 | link[i]=line[q+i].w=INF;
| ^
a.cc:46:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | link[a]=min(link[a],c+1);
| ^
a.cc:46:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | link[a]=min(link[a],c+1);
| ^
a.cc:46:28: error: no matching function for call to 'min(int (&)(const char*, const char*) noexcept, long long int)'
46 | link[a]=min(link[a],c+1);
| ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:46:28: note: deduced conflicting types for parameter 'const _Tp' ('int(const char*, const char*) noexcept' and 'long long int')
46 | link[a]=min(link[a],c+1);
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:46:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(const char*, const char*) noexcept'
46 | link[a]=min(link[a],c+1);
| ~~~^~~~~~~~~~~~~
a.cc:47:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
47 | link[b]=min(link[b],c+2);
| ^
a.cc:47:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
47 | link[b]=min(link[b],c+2);
| ^
a.cc:47:28: error: no matching function for call to 'min(int (&)(const char*, const char*) noexcept, long long int)'
47 | link[b]=min(link[b],c+2);
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:47:28: note: deduced conflicting types for parameter 'const _Tp' ('int(const char*, const char*) noexcept' and 'long long int')
47 | link[b]=min(link[b],c+2);
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:47:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int (*)(const char*, const char*) noexcept'
47 | link[b]=min(link[b],c+2);
| ~~~^~~~~~~~~~~~~
a.cc:52:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | minn=min(link[i],minn);
| ^
a.cc:52:25: error: no matching function for call to 'min(int (&)(const char*, const char*) noexcept, long long int&)'
52 | minn=min(link[i],minn);
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:52:25: note: deduced conflicting types for parameter 'const _Tp' ('int(const char*, const char*) noexcept' and 'long long int')
52 | minn=min(link[i],minn);
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:52:25: note: mismatched types 'std::i |
s326694418 | p03915 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)
#define int long long
int union_tree[200000];
int union_find(int now) {
if (union_tree[now] == now) return now;
return union_tree[now] = union_find(union_tree[now]);
}
void union_merge(int a, int b) {
a = union_find(a);
b = union_find(b);
union_tree[a] = b;
return;
}
long long gogo[200000];
#undef int
int main() {
#define int long long
long long n, query;
cin >> n >> query;
vector<tuple<long long, long long, long long>> edges;
REP(i, n) {
gogo[i] = 1e18;
}
REP(i, query) {
long long a, b, c;
cin >> a >> b >> c;
edges.push_back(make_tuple(c, a, b));
gogo[a + 1] = min(gogo[a + 1], c + 1LL);
gogo[b + 1] = min(gogo[b + 1], c + 2LL);
}
REP(i, 3) {
REP(j, n) {
gogo[j] = min(gogo[j], gogo[(j + n - 1) % n] + 2LL);
}
}
REP(q, n) {
edges.push_back(make_tuple(gogo[j], (j + n - 1) % n, j));
}
sort(edges.begin(), edges.end());
long long ans = 0;
REP(i, n) {
union_tree[i] = i;
}
REP(i, edges.size()) {
if (union_find(get<1>(edges[i])) != union_find(get<2>(edges[i]))) {
union_merge(get<1>(edges[i]), get<2>(edges[i]));
ans += get<0>(edges[i]);
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:78:49: error: 'j' was not declared in this scope
78 | edges.push_back(make_tuple(gogo[j], (j + n - 1) % n, j));
| ^
|
s999844610 | p03915 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=4e5+51;
struct Edge{
ll from,to;
li dist;
inline bool operator <(const Edge &rhs)const
{
return this->dist<rhs.dist;
}
};
Edge ed[MAXN];
ll nc,cnt,x,y,z,tot;
li dist[MAXN],boss[MAXN];
inline ll read()
{
register ll num=0,neg=1;
register char ch=getchar();
while(!isdigit(ch)&&ch!='-')
{
ch=getchar();
}
if(ch=='-')
{
neg=-1;
ch=getchar();
}
while(isdigit(ch))
{
num=(num<<3)+(num<<1)+(ch-'0');
ch=getchar();
}
return num*neg;
}
inline void setup(ll cnt)
{
for(register int i=0;i<cnt;i++)
{
boss[i]=i;
}
}
inline void update()
{
for(register int i=0;i<nc;i++)
{
dist[i]=min(dist[i],dist[(i+nc-1)%nc]+2);
}
}
inline ll findb(ll node)
{
if(node==boss[node])
{
return node;
}
boss[node]=findb(boss[node]);
return boss[node];
}
inline void Union(ll x,ll y)
{
ll bx=findb(x),by=findb(y);
if(bx!=by)
{
boss[by]=bx;
}
}
inline ll Kruskal()
{
li res=0,k=0;
sort(ed,ed+tot),setup(nc);
for(register int i=0;k<nc-1;i++)
{
if(findb(ed[i].from)!=findb(ed[i].to))
{
Union(ed[i].from,ed[i].to),res+=ed[i].dist,k++;
}
}
return res;
}
int main()
{
nc=read(),cnt=read(),memset(dist,0x3f,sizeof(dist));
for(register int i=0;i<cnt;i++)
{
x=read(),y=read(),z=read();
ed[tot++]=(Edge){x,y,z};
dist[x]=min(dist[x],z+1),dist[y]=min(dist[y],z+2);
}
update(),update();
for(register int i=0;i<=nc;i++)
{
ed[tot++]=(Edge){i,(i+1)%nc,dist[i]};
}
printf("%lld",Kruskal());
} | a.cc: In function 'll read()':
a.cc:19:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
19 | register ll num=0,neg=1;
| ^~~
a.cc:19:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
19 | register ll num=0,neg=1;
| ^~~
a.cc:20:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
20 | register char ch=getchar();
| ^~
a.cc: In function 'void setup(ll)':
a.cc:39:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
39 | for(register int i=0;i<cnt;i++)
| ^
a.cc: In function 'void update()':
a.cc:46:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
46 | for(register int i=0;i<nc;i++)
| ^
a.cc: In function 'll Kruskal()':
a.cc:72:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
72 | for(register int i=0;k<nc-1;i++)
| ^
a.cc: In function 'int main()':
a.cc:84:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
84 | for(register int i=0;i<cnt;i++)
| ^
a.cc:88:28: error: no matching function for call to 'min(li&, ll)'
88 | dist[x]=min(dist[x],z+1),dist[y]=min(dist[y],z+2);
| ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:88:28: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'int'})
88 | dist[x]=min(dist[x],z+1),dist[y]=min(dist[y],z+2);
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:88:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
88 | dist[x]=min(dist[x],z+1),dist[y]=min(dist[y],z+2);
| ~~~^~~~~~~~~~~~~
a.cc:88:53: error: no matching function for call to 'min(li&, ll)'
88 | dist[x]=min(dist[x],z+1),dist[y]=min(dist[y],z+2);
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:88:53: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'int'})
88 | dist[x]=min(dist[x],z+1),dist[y]=min(dist[y],z+2);
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:88:53: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
88 | dist[x]=min(dist[x],z+1),dist[y]=min(dist[y],z+2);
| ~~~^~~~~~~~~~~~~
a.cc:91:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
91 | for(register int i=0;i<=nc;i++)
| ^
|
s440963863 | p03915 | C++ | #include<bits/stdc++.h>
using namespace std;
namespace IO
{
char ibuf[(1<<21)+1],obuf[(1<<21)+1],st[15],*iS,*iT,*oS=obuf,*oT=obuf+(1<<21);
inline char Get()
{
return (iS==iT? (iT=(iS=ibuf)+fread(ibuf,1,(1<<21)+1,stdin),(iS==iT? EOF:*iS++)):*iS++);
}
inline void Flush()
{
fwrite(obuf,1,oS-obuf,stdout);
oS=obuf;
}
inline void Put(char x)
{
*oS++=x;
if(oS==oT)
Flush();
}
inline int read()
{
register int x=0;
register char ch=Get();
while(ch>'9'||ch<'0')
ch=Get();
while(ch>='0'&&ch<='9')
x=(x<<3)+(x<<1)+(ch^48),ch=Get();
return x;
}
inline void write(int x)
{
register int top=0;
while(x)
st[++top]=(x%10)+48,x/=10;
while(top)
Put(st[top--]);
}
}
using namespace IO;
const int N=200001,M=N<<3;
struct Edge
{
int u,v,w,Next;
Edge(){}
Edge(int U,int V,int W,int NEXT)
{
u=U,v=V,w=W,Next=NEXT;
}
bool operator<(Edge a)const
{
return w<a.w;
}
}edge[M];
int head[N],tot,f[N],d[N];
inline void add(int x,int y,int z)
{
edge[++tot]=Edge(x,y,z,head[x]),head[x]=tot;
}
int find(int x)
{
return x==f[x]? x:f[x]=find(f[x]);
}
bool cmp(int x,int y)
{
int fx=find(x),fy=find(y);
if(fx==fy)
return false;
if(fy>fx)
f[fy]=fx;
else
f[fx]=fy;
return true;
}
int main()
{
register int n=read(),q=read();
memset(d,0x3f sizeof d);
for(register int i=1,a,b,c;i<=q;++i)
{
a=read(),b=read(),c=read();
add(a,b,c);
d[a]=min(d[a],c+1),d[b]=min(d[b],c+2);
}
for(register int i=0;i<n;++i)
d[i]=min(d[i],d[(i-1+n)%n]+2);
for(register int i=0;i<n;++i)
d[i]=min(d[i],d[(i-1+n)%n]+2);
for(register int i=0;i<=n;++i)
add(i,(i+1)%n,d[i]);
sort(edge+1,edge+1+tot);
for(register int i=1;i<n;++i)
f[i]=i;
register int lt=n,ans=0;
for(register int i=1;i<=tot&<>1;++i)
if(cmp(edge[i].u, edge[i].v))
ans+=edge[i].w,--lt;
return printf("%lld", ans),0;
} | a.cc: In function 'int IO::read()':
a.cc:23:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
23 | register int x=0;
| ^
a.cc:24:31: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
24 | register char ch=Get();
| ^~
a.cc: In function 'void IO::write(int)':
a.cc:33:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | register int top=0;
| ^~~
a.cc: In function 'int main()':
a.cc:77:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
77 | register int n=read(),q=read();
| ^
a.cc:77:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
77 | register int n=read(),q=read();
| ^
a.cc:78:18: error: expected ')' before 'sizeof'
78 | memset(d,0x3f sizeof d);
| ~ ^~~~~~~
| )
a.cc:78:11: error: too few arguments to function 'void* memset(void*, int, size_t)'
78 | memset(d,0x3f sizeof d);
| ~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:1:
/usr/include/string.h:61:14: note: declared here
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ^~~~~~
a.cc:79:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
79 | for(register int i=1,a,b,c;i<=q;++i)
| ^
a.cc:79:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
79 | for(register int i=1,a,b,c;i<=q;++i)
| ^
a.cc:79:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
79 | for(register int i=1,a,b,c;i<=q;++i)
| ^
a.cc:79:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
79 | for(register int i=1,a,b,c;i<=q;++i)
| ^
a.cc:85:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
85 | for(register int i=0;i<n;++i)
| ^
a.cc:87:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
87 | for(register int i=0;i<n;++i)
| ^
a.cc:89:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
89 | for(register int i=0;i<=n;++i)
| ^
a.cc:92:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
92 | for(register int i=1;i<n;++i)
| ^
a.cc:94:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
94 | register int lt=n,ans=0;
| ^~
a.cc:94:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
94 | register int lt=n,ans=0;
| ^~~
a.cc:95:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
95 | for(register int i=1;i<=tot&<>1;++i)
| ^
|
s685524580 | p03915 | C++ | #include <iostream>
#include <vector>
using namespace std;
struct jh {
vector <int> num;
jh (int n) :num(n) {
for (int i=0;i<n;i++) num[i]=i;
}
int zhao (int x) {
if (num[x]==x) return x;
return num[x]=zhao(num[x]);
}
bool jiehe (int x,int y) {
x=zhao(x); y=zhao(y);
if (x==y) return false;
num[x]=y;
return true;
}
};
struct bian {
long long u,v,w;
};
bool operator < (const bian &a,const bian &b) {
return a.w<b.w;
}
int main () {
int n,q;
cin>>n>>q;
vector <bian> bian_new;
vector <long long> zxhf(n*2,1e10);
for (int i=0;i<q;i++) {
long long a,b,c;
cin>>a>>b>>c;
bian_new.push_back ({a,b,c});
zxhf[a]=min(zxhf[a],c+1);
zxhf[b]=min(zxhf[b],c+2);
zxhf[a+n]=min(zxhf[a+n],c+1);
zxhf[b+n]=min(zxhf[b+n],c+2);
}
for (int i=1;i<n*2;i++) zxhf[i]=min(zxhf[i],zxhf[i-1]+2);
for (int i=0;i<n;i++) bian_new.push_back({i,(i+1)%n,zxhf[i+n]});
sort(bian_new.begin(),bian_new.end());
jh uf(n);
long long jg=0;
for (bian e:bian_new) {
if (uf.jiehe(e.u,e.v)) jg+=e.w;
}
cout<<jg<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:42:5: error: 'sort' was not declared in this scope; did you mean 'short'?
42 | sort(bian_new.begin(),bian_new.end());
| ^~~~
| short
|
s466120740 | p03915 | C++ | #include <iostream>
#include <vector>
using namespace std;
struct jh {
vector <int> num;
jh (int n) :num(n) {
for (int i=0;i<n;i++) num[i]=i;
}
int zhao (int x) {
if (num[x]==x) return x;
return num[x]=zhao(num[x]);
}
bool jh (int x,int y) {
x=zhao(x); y=zhao(y);
if (x==y) return false;
num[x]=y;
return true;
}
};
struct bian {
long long u,v,w;
};
bool operator < (const bian &a,const bian &b) {
return a.w<b.w;
}
int main () {
int n,q;
cin>>n>>q;
vector <bian> bian;
vector <long long> zxhf(n*2,1e10);
for (int i=0;i<q;i++) {
long long a,b,c;
cin>>a>>b>>c;
bian.push_back ({a,b,c});
zxhf[a]=min(zxhf[a],c+1);
zxhf[b]=min(zxhf[b],c+2);
zxhf[a+n]=min(zxhf[a+n],c+1);
zxhf[b+n]=min(zxhf[b+n],c+2);
}
for (int i=1;i<n*2;i++) zxhf[i]=min(zxhf[i],zxhf[i-1]+2);
for (int i=0;i<n;i++) bian.push_back({i,(i+1)%n,zxhf[i+n]});
sort(bian.begin(),bian.end());
jh uf(n);
long long jg=0;
for (bian e : bian) {
if (uf.jh(e.u,e.v)) jg+=e.w;
}
cout<<jg<<endl;
return 0;
} | a.cc:13:5: error: return type specification for constructor invalid
13 | bool jh (int x,int y) {
| ^~~~
a.cc: In constructor 'jh::jh(int, int)':
a.cc:15:26: error: returning a value from a constructor
15 | if (x==y) return false;
| ^~~~~
a.cc:17:16: error: returning a value from a constructor
17 | return true;
| ^~~~
a.cc: In function 'int main()':
a.cc:42:5: error: 'sort' was not declared in this scope; did you mean 'short'?
42 | sort(bian.begin(),bian.end());
| ^~~~
| short
a.cc:45:14: error: expected ';' before 'e'
45 | for (bian e : bian) {
| ^~
| ;
a.cc:49:5: error: expected primary-expression before 'return'
49 | return 0;
| ^~~~~~
a.cc:48:20: error: expected ')' before 'return'
48 | cout<<jg<<endl;
| ^
| )
49 | return 0;
| ~~~~~~
a.cc:45:9: note: to match this '('
45 | for (bian e : bian) {
| ^
|
s759772909 | p03915 | C++ | #include <iostream>
#include <vector>
using namespace std;
struct jh {
vector <int> num;
jh (int n) :num(n) {
for (int i=0;i<n;i++) num[i]=i;
}
int zhao (int x) {
if (num[x]==x) return x;
return num[x]=zhao(num[x]);
}
bool jh (int x,int y) {
x=zhao(x); y=zhao(y);
if (x==y) return false;
num[x]=y;
return true;
}
};
struct bian {
long long u,v,w;
};
bool operator < (const bian &a,const bian &b) {
return a.w<b.w;
}
int main () {
int n,q;
cin>>n>>q;
vector <bian> bian;
vector <long long> zxhf(n*2,1e10);
for (int i=0;i<q;i++) {
long long a,b,c;
cin>>a>>b>>c;
bian.push_back ({a,b,c});
zxhf[a]=min(zxhf[a],c+1);
zxhf[b]=min(zxhf[b],c+2);
zxhf[a+n]=min(zxhf[a+n],c+1);
zxhf[b+n]=min(zxhf[b+n],c+2);
}
for (int i=1;i<n*2;i++) zxhf[i]=min(zxhf[i],zxhf[i-1]+2);
for (int i=0;i<n;i++) bian.push_back({i,(i+1)%n,zxhf[i+n]});
sort(bian.begin(),bian.end());
jh uf(n);
long long jg=0;
for (bian e:bian) {
if (uf.jh(e.u,e.v)) jg+=e.w;
}
cout<<jg<<endl;
return 0;
} | a.cc:13:5: error: return type specification for constructor invalid
13 | bool jh (int x,int y) {
| ^~~~
a.cc: In constructor 'jh::jh(int, int)':
a.cc:15:26: error: returning a value from a constructor
15 | if (x==y) return false;
| ^~~~~
a.cc:17:16: error: returning a value from a constructor
17 | return true;
| ^~~~
a.cc: In function 'int main()':
a.cc:42:5: error: 'sort' was not declared in this scope; did you mean 'short'?
42 | sort(bian.begin(),bian.end());
| ^~~~
| short
a.cc:45:14: error: expected ';' before 'e'
45 | for (bian e:bian) {
| ^~
| ;
a.cc:49:5: error: expected primary-expression before 'return'
49 | return 0;
| ^~~~~~
a.cc:48:20: error: expected ')' before 'return'
48 | cout<<jg<<endl;
| ^
| )
49 | return 0;
| ~~~~~~
a.cc:45:9: note: to match this '('
45 | for (bian e:bian) {
| ^
|
s751887803 | p03915 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
struct r{
int u,v,w;
}e[400050];
int w[200050],fa[200050],cnt,n,m;
ll ans;
int get_fa(int u){return fa[u]==u ? u:fa[u]=get_fa(fa[u]);}
bool cmp(r a,r b){return a.w<b.w;}
int main(){
scanf("%d%d",&n,&m);
memset(w,127,sizeof w);
for (int i=1;i<=m;i++){
scanf("%d%d%d",&e[i].u,&e[i].v,&e[i].w);
w[e[i].u]=std::min(w[e[i].u],e[i].w+1);
w[e[i].v]=std::min(w[e[i].v],e[i].w+2);
}
for (int i=0;i<n;i++) fa[i]=i;
for (int i=1;i<(n<<1);i++)
w[i]=std::min(w[i],w[i-1]+2);
for (int i=0;i<n;i++)
e[++m]=(r){i,(i+1)%n,std::min(w[i],w[i+n])};
std::sort(e+1,e+m+1,cmp);
for (int i=1;i<=m;i++){
if ((u=get_fa(e[i].u))==(v=get_fa(e[i].v))) continue;
fa[v]=u;
ans+=1ll*e[i].w;
cnt++;
if (cnt==n-1) {
printf("%lld",ans);
return 0;
}
}
} | a.cc: In function 'int main()':
a.cc:27:22: error: 'u' was not declared in this scope
27 | if ((u=get_fa(e[i].u))==(v=get_fa(e[i].v))) continue;
| ^
a.cc:27:42: error: 'v' was not declared in this scope
27 | if ((u=get_fa(e[i].u))==(v=get_fa(e[i].v))) continue;
| ^
a.cc:28:20: error: 'v' was not declared in this scope
28 | fa[v]=u;
| ^
a.cc:28:23: error: 'u' was not declared in this scope
28 | fa[v]=u;
| ^
|
s312071034 | p03915 | C++ | #include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#define md double
#define LL long long
using namespace std;
const int N=5e5;
int gi() {
int w=0;bool q=1;char c=getchar();
while ((c<'0'||c>'9') && c!='-') c=getchar();
if (c=='-') q=0,c=getchar();
while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
return q? w:-w;
}
int head[N],next[N],w[N],tot;
struct E{ int u,v,w; bool operator < (const E &b) const { return w<b.w; } }e[N];
inline void add(int k,int _w) { w[++tot]=_w,next[tot]=head[k],head[k]=tot; }
int fa[N];inline int find(int x) { return fa[x]==x?x:fa[x]=find(fa[x]); }
int main() {
int n=gi(),m=gi(),i,a,b,c,k,t,ans=0;
for (i=1;i<=m;i++) {
a=gi(),b=gi(),c=gi();
add(a,c+1);
add(b,c+2);
e[i]=(E){a,b,c};
if (a) add(0,c+1+((n-a)<<1));
if (b) add(0,c+2+((n-b)<<1));
}
for (k=0,t=1<<30;k<n;k++,t+=2) {
for (i=head[k];i;i=next[i]) t=min(t,w[i]);
e[++m]=(E){k,k+1==n?0:k+1,t};
}
sort(e+1,e+1+m);
for (i=0;i<n;i++) fa[i]=i;
for (i=1;i<=m;i++)
if (find(e[i].u)!=find(e[i].v)) {
ans+=e[i].w;
fa[fa[e[i].u]]=e[i].v;
}
printf("%d\n",ans);
return 0;
}
| a.cc: In function 'void add(int, int)':
a.cc:21:45: error: reference to 'next' is ambiguous
21 | inline void add(int k,int _w) { w[++tot]=_w,next[tot]=head[k],head[k]=tot; }
| ^~~~
In file included from /usr/include/c++/14/string:47,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:19:13: note: 'int next [500000]'
19 | int head[N],next[N],w[N],tot;
| ^~~~
a.cc: In function 'int main()':
a.cc:34:36: error: reference to 'next' is ambiguous
34 | for (i=head[k];i;i=next[i]) t=min(t,w[i]);
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:19:13: note: 'int next [500000]'
19 | int head[N],next[N],w[N],tot;
| ^~~~
|
s009718307 | p03915 | C++ | #include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;
const int N=200005;
const int inf=1000000009;
typedef double db;
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
/*inline int rd() {
char c=getchar(); int t=0,f=1;
while (c<48) c=getchar();
while (c>47) t=(t<<1)+(t<<3)+c-48,c=getchar(); return t*f;
}*/
char Buf[30000000],*c=Buf;
inline int rd() {
int t=0;
while (*c<48) c++;
while (*c>47) t=(t<<1)+(t<<3)+*c-48,c++; return t;
}
void wt(int x) {
if (x<0) putchar('-'),wt(-x);
else { if (x>9) wt(x/10); putchar(x%10+48); }
}
struct Data {
int A,B,val,k;
bool operator>(Data P)const {
return val>P.val;
}
}TP,tmp;
struct Priority_Queue {
int size;
Data Heap[N<<1];
Data top() { return Heap[1]; }
inline void down() {
int x=1,k=1;
while (1) {
if ((x<<1)<=size && Heap[k]>Heap[x<<1]) k=x<<1;
if ((x<<1|1)<=size && Heap[k]>Heap[x<<1|1]) k=x<<1|1;
if (x==k) return; swap(Heap[x],Heap[k]); x=k;
}
}
inline void up(int x) {
while (x>1) {
if (Heap[x>>1]>Heap[x])
swap(Heap[x>>1],Heap[x]),x>>=1;
else return;
}
}
inline void pop() { swap(Heap[1],Heap[size--]); down(); }
inline void push(Data P) { Heap[++size]=P; up(size); }
}Q;
struct Hash_Table {
bool key[60000007][2];
inline int f(Data P) { return (1ll*P.A*500009%60000007+P.B)%60000007; }
inline void ins(Data P) { key[f(P)][P.k]=1; swap(P.A,P.B),P.k^=1; key[f(P)][P.k]=1; return; }
inline bool find(Data P) { if (key[f(P)][P.k]) return 1; swap(P.A,P.B),P.k^=1; return key[f(P)][P.k]; }
}Hash;
//priority_queue<Data>Q;
int n,m,fa[N],key; ll Ans;
//map<pair<pii,int>,bool>Map;
inline int get(int x) { return fa[x]==x?x:fa[x]=get(fa[x]); }
inline void inc(Data &P) {
if (P.k==0) P.k=1,P.A++;
else P.k=0,P.B++; P.val++;
if (P.A==n) P.A=0;
if (P.B==n) P.B=0; return;
}
int main() {
fread(Buf,1,29999999,stdin);
n=rd(),m=rd(); int cnt=0; tmp.k=0;
For (i,1,m) {
tmp.A=rd(),tmp.B=rd(),tmp.val=rd();
Q.push(tmp);
}
For (i,0,n-1) fa[i]=i;
while (Q.size) {
if (key==n-1) break;
TP=Q.top(),Q.pop();
cnt++;
// if (Map.find(mp(mp(TP.A,TP.B),TP.k))!=Map.end()) continue; else Map[mp(mp(TP.A,TP.B),TP.k)]=1;
// if (Map.find(mp(mp(TP.B,TP.A),TP.k^1))!=Map.end()) continue; else Map[mp(mp(TP.B,TP.A),TP.k^1)]=1;
if (Hash.find(TP)) continue; else Hash.ins(TP);
if (get(TP.A)!=get(TP.B)) {
Ans+=TP.val,key++;
fa[get(TP.A)]=get(TP.B);
}
// else continue;
inc(TP),Q.push(TP);
}
cout<<Ans<<endl;
// printf("%d\n",cnt);
return 0;
}
/*
7 1
5 2 1
*/
| a.cc: In function 'int main()':
a.cc:122:1: error: 'cout' was not declared in this scope
122 | cout<<Ans<<endl;
| ^~~~
a.cc:12:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
11 | #include<algorithm>
+++ |+#include <iostream>
12 |
a.cc:122:12: error: 'endl' was not declared in this scope
122 | cout<<Ans<<endl;
| ^~~~
a.cc:12:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
11 | #include<algorithm>
+++ |+#include <ostream>
12 |
|
s285891925 | p03917 | C++ | #include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#define llint long long
#define mod 1000000007
using namespace std;
typedef pair<llint, llint> P;
struct UnionFind{
int size;
vector<int> parent;
UnionFind(){}
UnionFind(int size){
this->size = size;
parent.resize(size+1);
init();
}
void init(){
for(int i = 0; i <= size; i++) parent[i] = i;
}
int root(int i){
if(parent[i] == i) return i;
return parent[i] = root(parent[i]);
}
bool same(int i, int j){
return root(i) == root(j);
}
void unite(int i, int j){
int root_i = root(i), root_j = root(j);
if(root_i == root_j) return;
parent[root_i] = root_j;
}
};
llint h, w;
char c[205][205];
bool b[205][205];
map<char, llint> mp;
map<llint, P> mp2;
UnionFind uf(405);
const int FACT_MAX = 15;
llint fact[FACT_MAX], fact_inv[FACT_MAX];
llint modpow(llint a, llint n)
{
if(n == 0) return 1;
if(n % 2){
return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
}
else{
return modpow((a*a)%mod, n/2) % mod;
}
}
void make_fact()
{
llint val = 1;
fact[0] = 1;
for(int i = 1; i < FACT_MAX; i++){
val *= i;
val %= mod;
fact[i] = val;
}
fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
for(int i = FACT_MAX-2; i >= 0; i--){
fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
}
}
int main(void)
{
make_fact();
cin >> h >> w;
for(int y = 1; y <= h; y++){
for(int x = 1; x <= w; x++){
cin >> c[x][y];
}
}
llint ans = 1;
if(h % 2){
string s, t;
for(int i = 1; i <= w; i++) s += c[i][h/2+1];
t = s;
reverse(t.begin(), t.end());
if(s != t) ans *= 2;
for(int y = h/2+1; y < h; y++){
for(int x = 1; x <= w; x++){
c[x][y] = c[x][y+1];
}
}
h--;
}
if(w % 2){
string s, t;
for(int i = 1; i <= h; i++) s += c[w/2+1][i];
t = s;
reverse(t.begin(), t.end());
if(s != t) ans *= 2;
for(int x = w/2+1; x < w; x++){
for(int y = 1; y <= h; y++){
c[x][y] = c[x+1][y];
}
}
w--;
}
if(h >= 1 && w >= 1){
for(int y = 1; y <= h/2; y++){
for(int x = 1; x <= w/2; x++){
mp.clear();
mp[c[x][y]]++;
mp[c[w+1-x][y]]++;
mp[c[w+1-x][h+1-y]]++;
mp[c[x][h+1-y]]++;
llint mul = fact[4];
for(auto it = mp.begin(); it != mp.end(); it++) mul /= fact[it->second];
if(mp.size() == 4) mul /= 2, b[x][y] = true;
ans *= mul, ans %= mod;
}
}
}
h /= 2, w /= 2;
for(int y = 1; y <= h; y++){
for(int x = 1; x <= w; x++){
if(b[x][y]) uf.unite(x, w+y);
}
}
for(int x = 1; x <= w; x++) mp2[uf.root(x)].first++;
for(int y = 1; y <= h; y++) mp2[uf.root(y+w)].second++;
llint cnt = 0;
for(auto it = mp2.begin(); it != mp2.end(); it++){
cnt += it->second.first + it->second.second - 1;
}
ans *= modpow(2, cnt), ans %= mod;
cout << ans << endl;
return 0;
} | a.cc:13:9: error: 'vector' does not name a type
13 | vector<int> parent;
| ^~~~~~
a.cc: In constructor 'UnionFind::UnionFind(int)':
a.cc:18:17: error: 'parent' was not declared in this scope
18 | parent.resize(size+1);
| ^~~~~~
a.cc: In member function 'void UnionFind::init()':
a.cc:22:48: error: 'parent' was not declared in this scope
22 | for(int i = 0; i <= size; i++) parent[i] = i;
| ^~~~~~
a.cc: In member function 'int UnionFind::root(int)':
a.cc:25:20: error: 'parent' was not declared in this scope
25 | if(parent[i] == i) return i;
| ^~~~~~
a.cc:26:24: error: 'parent' was not declared in this scope
26 | return parent[i] = root(parent[i]);
| ^~~~~~
a.cc: In member function 'void UnionFind::unite(int, int)':
a.cc:34:17: error: 'parent' was not declared in this scope
34 | parent[root_i] = root_j;
| ^~~~~~
|
s145666751 | p03917 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int H,W;
string s[200];
typedef long long ll;
ll mod=1e9+7;
int calc2(string s){
string t=s;
reverse(all(t));
if(s==t) return 1;
return 2;
}
int f[5]={1,1,2,6,24};
int si[12][4];
int calc(string s){
set<string> st;
rep(i,12){
string t;
rep(j,4) t+=s[si[i][j]];
st.insert(t);
}
return st.size();
}
int calcx(string s){
map<char,int> mp;
rep(i,4) mp[s[i]]++;
int ret=24;
for(auto it:mp){
ret/=f[it.sc];
}
// show(s);
// show(ret);
return ret;
}
bool odh[200],odw[200];
int main(){
{
int a[4]={0,1,2,3};
int I=0;
do{
int inv=0;
rep(i,4) rep(j,i) if(a[j]>a[i]) inv++;
if(inv%2==0){
rep(i,4) si[I][i]=a[i];
I++;
}
}while(next_permutation(a,a+4));
assert(I==12);
}
cin>>H>>W;
rep(i,H) cin>>s[i];
ll ans=1;
rep(i,H/2) rep(j,W/2){
string t;
t+=s[i][j];
t+=s[i][W-1-j];
t+=s[H-1-i][j];
t+=s[H-1-i][W-1-j];
ans=ans*calc(t)%mod;
if(calc(t)!=calcx(t)){
odh[i]=1;
odw[j]=1;
}
}
int tmp1=0,tmp2=0;
rep(i,H/2) if(odh[i]) tmp1++;
rep(i,W/2) if(odw[i]) tmp2++;
ll ff=0;
ll x=1;
rep(i,tmp1) x=x*2%mod;
f=x;
x=1;
rep(i,tmp2) x=x*2%mod;
f+=x;
f%=mod;
ans=ans*f%mod;
if(H%2){
string t=s[H/2];
ans=ans*calc2(t)%mod;
}
if(W%2){
string t;
rep(i,H) t+=s[i][W/2];
ans=ans*calc2(t)%mod;
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:85:10: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'int [5]'
85 | f=x;
| ~^~
a.cc:88:10: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'int [5]'
88 | f+=x;
| ~^~~
a.cc:89:10: error: invalid operands of types 'int [5]' and 'll' {aka 'long long int'} to binary 'operator%'
89 | f%=mod;
| ~^~~~~
a.cc:89:10: note: in evaluation of 'operator%=(int [5], ll {aka long long int})'
a.cc:90:16: error: invalid operands of types 'll' {aka 'long long int'} and 'int [5]' to binary 'operator*'
90 | ans=ans*f%mod;
| ~~~^~
| | |
| | int [5]
| ll {aka long long int}
|
s011272783 | p03918 | C++ | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define N 333
int n;
int U[N], L[N], R[N], D[N];
int row[N], col[N];
bool a[N][N];
char wc[N*N]; int wn[N*N];
#define P 1000000007
typedef long long ll;
set<ll> A;
bool gg() {
ll S = 0;
for (int i = 0; i < n; i ++)
for (int j = 0; i < n; j ++)
((S *= P) += a[i][j]);
if (A.find(S) != A.end()) return true;
A.insert(S);
return false;
}
void ff(int t) {
if (t == n*n) {
for (int i = 0; i < n*n; i ++) {
cout << wc[i] << wn[i]+1 << endl;
}
exit(0);
}
static int _ = 0;
_++;
if (_ > 1e7) return;
for (int i = 0; i < n; i ++) if (U[i]) {
U[i] --;
int x = 0;
while (a[x][i]) x++;
a[x][i] = 1;
row[x] ++; col[i] ++;
wc[t] = 'U'; wn[t] = i;
if (U[i] + D[i] + col[i] <= n &&
L[x] + R[x] + row[x] <= n) ff(t+1);
U[i] ++;
a[x][i] = 0;
row[x] --; col[i] --;
}
for (int i = 0; i < n; i ++) if (D[i]) {
D[i] --;
int x = n-1;
while (a[x][i]) x--;
a[x][i] = 1;
row[x] ++; col[i] ++;
wc[t] = 'D'; wn[t] = i;
if (U[i] + D[i] + col[i] <= n &&
L[x] + R[x] + row[x] <= n) ff(t+1);
D[i] ++;
a[x][i] = 0;
row[x] --; col[i] --;
}
for (int i = 0; i < n; i ++) if (L[i]) {
L[i] --;
int x = 0;
while (a[i][x]) x++;
a[i][x] = 1;
row[i] ++; col[x] ++;
wc[t] = 'L'; wn[t] = i;
if (U[x] + D[x] + col[x] <= n &&
L[i] + R[i] + row[i] <= n) ff(t+1);
L[i] ++;
a[i][x] = 0;
row[i] --; col[x] --;
}
for (int i = 0; i < n; i ++) if (R[i]) {
R[i] --;
int x = n-1;
while (a[i][x]) x--;
a[i][x] = 1;
row[i] ++; col[x] ++;
wc[t] = 'R'; wn[t] = i;
if (U[x] + D[x] + col[x] <= n &&
L[i] + R[i] + row[i] <= n) ff(t+1);
R[i] ++;
a[i][x] = 0;
row[i] --; col[x] --;
}
}
int main() {
cin >> n;
for (int i = 0; i < n; i ++) cin >> U[i];
for (int i = 0; i < n; i ++) cin >> D[i];
for (int i = 0; i < n; i ++) cin >> L[i];
for (int i = 0; i < n; i ++) cin >> R[i];
bool F = true;
for (int i = 0; i < n; i ++) if (U[i] + D[i] > n || L[i] + R[i] > n) F = false;
if (F) ff();
puts ("NO");
return 0;
} | a.cc: In function 'int main()':
a.cc:105:18: error: too few arguments to function 'void ff(int)'
105 | if (F) ff();
| ~~^~
a.cc:33:6: note: declared here
33 | void ff(int t) {
| ^~
|
s229221628 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int H,W;
cin >> H >> W;
vector<vector<string>> S(H,vector<string>(W));
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
cin >> S.at(i).at(j);
if (S.at(i).at(j) == "snuke"){
cout << (char)("A" + i) << i + 1 << endl;
}
}
}
} | a.cc: In function 'int main()':
a.cc:12:17: error: cast from 'const char*' to 'char' loses precision [-fpermissive]
12 | cout << (char)("A" + i) << i + 1 << endl;
| ^~~~~~~~~~~~~~~
|
s670313281 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, w;
cin >> h >> w;
vector<vector<int>> data(h, vector<int>(w));
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
cin >> data.at(i).at(j);
}
}
int a, b;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (data.at(i).at(j) == "snuke") {
a = i;
b = j;
}
}
}
char c = b + 1 + 64;
cout << c << a + 1 << endl;
}
| a.cc: In function 'int main()':
a.cc:16:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
16 | if (data.at(i).at(j) == "snuke") {
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~
|
s130187091 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, w;
cin >> h >> w;
vector<vector<int>> data(h, vector(w));
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
cin >> data.at(i).at(j);
}
}
int a, b;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (data.at(i).at(j) == "snuke") {
a = i;
b = j;
}
}
}
char c = b + 1 + 64;
cout << c << a + 1 << endl;
}
| a.cc: In function 'int main()':
a.cc:7:39: error: class template argument deduction failed:
7 | vector<vector<int>> data(h, vector(w));
| ^
a.cc:7:39: error: no matching function for call to 'vector(int&)'
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: couldn't deduce template parameter '_Tp'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: couldn't deduce template parameter '_Tp'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note: template argument deduction/substitution failed:
a.cc:7:39: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>'
2033 | vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate expects 2 arguments, 1 provided
a.cc:16:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
16 | if (data.at(i).at(j) == "snuke") {
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~
|
s638419820 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, w;
cin >> h >> w;
vector<vector<int>> data(h, vector(w));
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
cin >> data.at(i).at(j);
}
}
int a, b;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (data.at(i).at(j) == "snuke") {
a = i;
b = j;
}
}
}
char c = j + 1 + 64;
cout << c << a + 1 << endl;
}
| a.cc: In function 'int main()':
a.cc:7:39: error: class template argument deduction failed:
7 | vector<vector<int>> data(h, vector(w));
| ^
a.cc:7:39: error: no matching function for call to 'vector(int&)'
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: couldn't deduce template parameter '_Tp'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: template argument deduction/substitution failed:
a.cc:7:39: note: couldn't deduce template parameter '_Tp'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note: template argument deduction/substitution failed:
a.cc:7:39: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
7 | vector<vector<int>> data(h, vector(w));
| ^
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>'
2033 | vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate expects 2 arguments, 1 provided
a.cc:16:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
16 | if (data.at(i).at(j) == "snuke") {
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~
a.cc:22:12: error: 'j' was not declared in this scope
22 | char c = j + 1 + 64;
| ^
|
s457190320 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int h,w,u=1;
cin >> h >> w;
string s[h][w];
char t='A';
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin >> s[i][j];
if(s[i][j]=="Snuke"){
cout << t << u << endl;
return 0;
}
t++;
}
u++;
}
}
| a.cc:12:22: error: extended character is not valid in an identifier
12 | cout << t << u << endl;
| ^
a.cc: In function 'int main()':
a.cc:12:22: error: 'u\U00003000' was not declared in this scope
12 | cout << t << u << endl;
| ^~~
|
s572575865 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int h,w,u=1;
cin >> h >> w;
string s[h][w];
char t='A';
for(int i=0;i<n;i++){
for(int j=0;j<n;i++){
if(s[h][w]=="Snuke"){
cout << t << u;
return 0;
}
t++;
}
u++;
}
} | a.cc: In function 'int main()':
a.cc:8:17: error: 'n' was not declared in this scope
8 | for(int i=0;i<n;i++){
| ^
|
s315419861 | p03919 | C | #include <stdio.h>
int main(void){
int a,b,i,j,c=0;
scanf("%d%d",&a,&b);
char snuke[a+1][b*6+5];
for(i=0;i<a;i++){
scanf("%s",snuke[i]);
}
i=0;
while(c==0){
j=0;
while((c==0)&&(j<b*6-2)){
if(snuke[i][j]=='s'){
if(snuke[i][j+1]=='n'){
if(snuke[i][j+2]=='u'){
if(snuke[i][j+3]=='k'){
if(snuke[i][j+4]=='e'){
c=1;
}
}
}
}
}
j+=6;
}
i++;
}
printf("%c%d",A+j/6-1,i);
return 0;
} | main.c: In function 'main':
main.c:28:23: error: 'A' undeclared (first use in this function)
28 | printf("%c%d",A+j/6-1,i);
| ^
main.c:28:23: note: each undeclared identifier is reported only once for each function it appears in
|
s247883055 | p03919 | C | #include <stdio.h>
int main(void){
int a,b,i,j,c=0;
scanf("%d%d",&a,&b);
char snuke[a+1][b*6+5]
for(i=0;i<a;i++){
scanf("%s",snuke[i]);
}
i=0;
while(c==0){
j=0;
while((c==0)&&(j<b*6-2)){
if(snuke[i][j]=='s'){
if(snuke[i][j+1]=='n'){
if(snuke[i][j+2]=='u'){
if(snuke[i][j+3]=='k'){
if(snuke[i][j+4]=='e'){
c=1;
}
}
}
}
}
j+=6;
}
i++;
}
printf("%c%d",A+j/6-1,i);
return 0;
} | main.c: In function 'main':
main.c:6:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for'
6 | for(i=0;i<a;i++){
| ^~~
main.c:7:28: error: 'snuke' undeclared (first use in this function)
7 | scanf("%s",snuke[i]);
| ^~~~~
main.c:7:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:28:23: error: 'A' undeclared (first use in this function)
28 | printf("%c%d",A+j/6-1,i);
| ^
|
s895748718 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int h,w;
cin >> h >> w;
vector<vector<string>> s(h,vector<string>(w,""));
int tt=-1,yk=-1;
for(int i = 0;i < h;i++)
{
for(int j = 0;j < w;j++)
{
cin >> s.at(i).at(j)
if(s.at(i).at(j) == "snuke")
{
tt = i;
yk = j;
break;
}
if(tt >= 0)
{
break;
}
}
}
tt++;
char ykk = 'A' + yk;
cout << ykk << tt <<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:45: error: expected ';' before 'if'
13 | cin >> s.at(i).at(j)
| ^
| ;
14 | if(s.at(i).at(j) == "snuke")
| ~~
|
s221136952 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
int H, W; cin >> H >> W;
int i = 0; int j = 0;
string s;
while (i < H){
while(j < W){
cin >> s;
if (s == "snuke"){
printf(%c, 'A' + i);
return 0;
j++;
}
i++;
}
}
}
| a.cc: In function 'int main()':
a.cc:15:16: error: expected primary-expression before '%' token
15 | printf(%c, 'A' + i);
| ^
a.cc:15:17: error: 'c' was not declared in this scope
15 | printf(%c, 'A' + i);
| ^
|
s501297440 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
int H, W; cin >> H >> W;
int i = 0; int j = 0;
string s;
while (i < H){
while(j < W){
cin >> s;
if (s == "snuke"){
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
int H, W; cin >> H >> W;
int i = 0; int j = 0;
string s;
while (i < H){
while(j < W){
cin >> s;
if (s == "snuke"){
printf(%c, 'A' + i);
return 0;
j++;
}
i++;
}
}
}
return 0;
j++;
}
i++;
}
}
}
| a.cc: In function 'int main()':
a.cc:21:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
21 | int main() {
| ^~
a.cc:21:9: note: remove parentheses to default-initialize a variable
21 | int main() {
| ^~
| --
a.cc:21:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:21:12: error: a function-definition is not allowed here before '{' token
21 | int main() {
| ^
|
s145824662 | p03919 | Java | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.solve();
}
public void solve() {
Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int H = scan.nextInt();
int W = scan.nextInt();
int ans_H = 0;
int ans_W = 0;
for (int i = 1; i <= H; i++) {
for (int j = 0; j < W; j++) {
String s = scan.next();
if ("snuke".equals(s)) {
ans_H = i;
ans_W = j;
break;
}
}
}
StringBuilder sb = new StringBuilder();
sb.append((char)((int)'A'+j));
sb.append(j);
System.out.println(sb.toString());
}
}
| Main.java:28: error: cannot find symbol
sb.append((char)((int)'A'+j));
^
symbol: variable j
location: class Main
Main.java:29: error: cannot find symbol
sb.append(j);
^
symbol: variable j
location: class Main
2 errors
|
s899459744 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int w,h,tmp;
string s;
cin >> w >> h;
for(int i=0; i<w*h; i++){
cin >> s;
if(s=="snuke"){
tmp = i;
break;
}
}
char x;
x = 64+(i+1)%h;
cout << x << 1+(i/h) << endl;
//cin >> n >> w >> h;
//cout << (n-w)*(n-h) << endl;
} | a.cc: In function 'int main()':
a.cc:16:15: error: 'i' was not declared in this scope
16 | x = 64+(i+1)%h;
| ^
|
s248916572 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int w,h;
string s;
cin >> w >> h;
for(int i=0; i<w*h; i++){
cin >> s;
if(s=="snuke") break;
}
char x;
x = 64+(i+1)%h;
cout << x << 1+(i/h) << endl;
//cin >> n >> w >> h;
//cout << (n-w)*(n-h) << endl;
} | a.cc: In function 'int main()':
a.cc:13:11: error: 'i' was not declared in this scope
13 | x = 64+(i+1)%h;
| ^
|
s653017055 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int h,w,x,y;
cin >> h >> w ;
vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
vector<vector<string>> HW(h,vector<string>(w));
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin >> HW.at(i).at(j) ;
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(HW.at(i).at(j) == "snuke"){
y = i;
x = j;
}
}
}
cout << abc.at(x) << y+1 << endl;
} | a.cc: In function 'int main()':
a.cc:7:17: error: 'A' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:19: error: 'B' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:21: error: 'C' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:23: error: 'D' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:25: error: 'E' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:27: error: 'F' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:29: error: 'G' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:31: error: 'H' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:33: error: 'I' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:35: error: 'J' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:37: error: 'K' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:39: error: 'L' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:41: error: 'M' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:43: error: 'N' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:45: error: 'O' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:47: error: 'P' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:49: error: 'Q' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:51: error: 'R' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:53: error: 'S' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:55: error: 'T' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:57: error: 'U' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:59: error: 'V' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:61: error: 'W' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:63: error: 'X' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:65: error: 'Y' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:67: error: 'Z' was not declared in this scope
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
a.cc:7:68: error: no matching function for call to 'std::vector<char>::vector(<brace-enclosed initializer list>)'
7 | vector<char>abc{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z};
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = char; _Alloc = std::allocator<char>]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 3 arguments, 26 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate expects 2 arguments, 26 provided
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>; std::__type_identity_t<_Alloc> = std::allocator<char>]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 26 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 26 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 26 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>; std::__type_identity_t<_Alloc> = std::allocator<char>]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 26 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = char; _Alloc = std::allocator<char>]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 26 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 26 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; size_type = long unsigned int; value_type = char; allocator_type = std::allocator<char>]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 3 arguments, 26 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; size_type = long unsigned int; allocator_type = std::allocator<char>]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate expects 2 arguments, 26 provided
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 26 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = char; _Alloc = std::allocator<char>]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_v |
s735249686 | p03919 | C++ | #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main (){
long long int a,b;
char d,e;
string c[30][30];
cin >>a >>b ;
for(int i=0;i<=a;i++){
for(int j=0;j<b;j++)
cin >> c[i][j];
}
d ='A';
for(int i=0;i<=a;i++){
for(int j=0;j<b;j++)
if( c[i][j] == 'snuke'){
d += i;
cout << d<<j<< endl;
}
}
}
| a.cc:23:22: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:23:19: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
23 | if( c[i][j] == 'snuke'){
| ~~~~~~~ ^~ ~~~~~~~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:3:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
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:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
In file included from /usr/include/c++/14/string:43,
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/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:23:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
|
s565980551 | p03919 | C++ | #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main (){
long long int a,b;
char c,d;
string c[30][30];
cin >>a >>b ;
for(int i=0;i<=a;i++){
for(int j=0;j<b;j++)
cin >> c[i][j];
}
c ='A';
for(char i=0;i<=a;i++){
for(int j=0;j<b;j++)
if( c[i][j] == 'snuke'){
c += i;
cout << i<<j<< endl;
}
}
}
| a.cc:23:22: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
23 | if( c[i][j] == 'snuke'){
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:10: error: conflicting declaration 'std::string c [30][30]'
11 | string c[30][30];
| ^
a.cc:10:8: note: previous declaration as 'char c'
10 | char c,d;
| ^
a.cc:17:11: error: invalid types 'char[int]' for array subscript
17 | cin >> c[i][j];
| ^
a.cc:23:12: error: invalid types 'char[char]' for array subscript
23 | if( c[i][j] == 'snuke'){
| ^
|
s272263106 | p03919 | C++ | #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main (){
long long int a,b;
string c[30][30];
cin >>a >>b ;
for(char i=A;i<=Z;i++){
for(int j=0;j<b;j++)
cin >> c[i][j];
}
for(char i=A;i<=Z;i++){
for(int j=0;j<b;j++)
if( c[i][j] == 'snuke'){
cout << i<<j<< endl;
}
}
}
| a.cc:22:22: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:14:14: error: 'A' was not declared in this scope
14 | for(char i=A;i<=Z;i++){
| ^
a.cc:14:19: error: 'Z' was not declared in this scope
14 | for(char i=A;i<=Z;i++){
| ^
a.cc:20:14: error: 'A' was not declared in this scope
20 | for(char i=A;i<=Z;i++){
| ^
a.cc:20:19: error: 'Z' was not declared in this scope
20 | for(char i=A;i<=Z;i++){
| ^
a.cc:22:19: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
22 | if( c[i][j] == 'snuke'){
| ~~~~~~~ ^~ ~~~~~~~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:3:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
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:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
In file included from /usr/include/c++/14/string:43,
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/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:22:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
22 | if( c[i][j] == 'snuke'){
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | oper |
s843732689 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int H,W,h,w;
string s;
for (int i = 0; i < H*W; i++){
cin >> s;
if (s=="snuke") break;
}
h = i/H+1;
w = i-h*H+1;
char p = 'A';
p = p - 1 + w;
cout << p << h;
} | a.cc: In function 'int main()':
a.cc:10:7: error: 'i' was not declared in this scope
10 | h = i/H+1;
| ^
|
s095187536 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
string alp="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
cin>>a>>b;
vector<vector<string>> s(a,vector<string> b);
for(int i=0;i<a;i++){
for(int j=0;j<b;j++){
cin>>s[i][j];
if(s[i][j]=="snuke"){
cout<<alp.at(j)<<i+1<<endl;
return 0;
}
}
}
} | a.cc: In function 'int main()':
a.cc:8:45: error: expected primary-expression before 'b'
8 | vector<vector<string>> s(a,vector<string> b);
| ^
|
s810393027 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
string alp="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
cin>>a>>b;
vector<vector<string>> s(a,vector<string> b);
for(int i=0;i<a;i++){
for(int j=0;j<b;j++)
cin>>s[i][j];
if(s[i][j]=="snuke"){
cout<<alp.at(j)<<i+1<<endl;
return 0;
}
}
}
} | a.cc: In function 'int main()':
a.cc:8:45: error: expected primary-expression before 'b'
8 | vector<vector<string>> s(a,vector<string> b);
| ^
a.cc:12:15: error: 'j' was not declared in this scope
12 | if(s[i][j]=="snuke"){
| ^
a.cc: At global scope:
a.cc:18:1: error: expected declaration before '}' token
18 | }
| ^
|
s117139440 | p03919 | C++ | #include<iostream>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;
int main(){
int H,W;
cin>>H>>W;
FOR(i,0,H){
FOR(i,0,W){
string S;
cin>>S;
if(S=="snuke"){
char a=j+'A';
cout<<a<<i+1<<endl;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:12:16: error: 'j' was not declared in this scope
12 | char a=j+'A';
| ^
|
s839172070 | p03919 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;
int main(){
int H,W;
cin>>H>>W;
REP(i,H){
REP(j,W){
string S;
cin>>S;
if(S=="snuke"){
string a=j+'A';
cout<<a<<i+1<<endl;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:27:19: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
27 | string a=j+'A';
| ~^~~~
|
s473485757 | p03919 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;
int main(){
int H,W;
cin>>H>>W;
string S;
REP(i,H){
REP(j,W){
cin>>S;
if(S[i][j]=="snuke") cout<<j+'A'<<i+1<<endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:26:14: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
26 | if(S[i][j]=="snuke") cout<<j+'A'<<i+1<<endl;
| ^
|
s812400171 | p03919 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(void){
int m,n;
cin >> m >> n;
vector<vector<string>>word(m,vector<string>(n));
for(int m=0;i<m;i++){
for(int j=0;j<n;j++){
cin >> word[i][j];
}
}
int a;
char b;
for(int i=;i<n;i++){
for(int j=0;j<n;j++){
if(word[i][j] == "snuke"){
a = m + 1;
b = j + 'A';
}
}
}
cout << b << a << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:15: error: 'i' was not declared in this scope
9 | for(int m=0;i<m;i++){
| ^
a.cc:18:13: error: expected primary-expression before ';' token
18 | for(int i=;i<n;i++){
| ^
|
s664799746 | p03919 | C++ | [(print(chr(ord('A')+i)+str(h+1)),quit())for H,W in [map(int,input().split())]for h in range(H)for i,v in enumerate(input().split())if v=="snuke"] | a.cc:1:1: error: expected unqualified-id before '[' token
1 | [(print(chr(ord('A')+i)+str(h+1)),quit())for H,W in [map(int,input().split())]for h in range(H)for i,v in enumerate(input().split())if v=="snuke"]
| ^
|
s301512655 | p03919 | C++ | #include<iostream>
using namespace std;
int main(){
string s[26][26];
int a,b;
cin>>a>>b;
for(int i=0;i<a;i++){
for(int j=0;j<b;j++)cin>>s[i][j];
if(s[i][j]=="snuke")cout<<char(j+'A')<<i+1<<'\n';
}
} | a.cc: In function 'int main()':
a.cc:9:13: error: 'j' was not declared in this scope
9 | if(s[i][j]=="snuke")cout<<char(j+'A')<<i+1<<'\n';
| ^
|
s372569155 | p03919 | C | #include <stdio.h>
int main(){
int h,w;
char a[6];
scanf("%d%d",&h,&w);
for(int i=0;i<w;i++)for(int j=;j<h;j++){
scanf("%s",a);
if(a[2]=='u')printf("%c%d",'a'+i,1+j);
}
return 0;
} | main.c: In function 'main':
main.c:6:33: error: expected expression before ';' token
6 | for(int i=0;i<w;i++)for(int j=;j<h;j++){
| ^
|
s903957219 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int x, y;
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++) {
string a;
cin >> a;
if (a == "snuke") {
cout << (string)(i + 'A') << 1 + j;
return 0;
}
}
}
} | a.cc: In function 'int main()':
a.cc:10:33: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int)'
10 | cout << (string)(i + 'A') << 1 + j;
| ^
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,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc())
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
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/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]':
/usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
149 | using _If_sv = enable_if_t<
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:797:30: required from here
797 | template<typename _Tp, typename = _If_sv<_Tp, void>>
| ^~~~~~~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>'
2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
788 | basic_string(const _Tp& __t, size_type __pos, size_type __n,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
765 | basic_string(_InputIterator __beg, _InputIterator __end,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed:
a.cc:10:28: note: cannot convert '(i + 65)' (type 'int') to type 'const char*'
10 | cout << (string)(i + 'A') << 1 + j;
| ~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
721 | basic_string(basic_string&& __str, const _Alloc& __a)
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
716 | basic_string(const basic_string& __str, const _Alloc& __a)
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:716:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:711:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:711:45: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<char>'
711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:682:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
682 | basic_string(basic_string&& __str) noexcept
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:682:35: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>&&'
682 | basic_string(basic_string&& __str) noexcept
| ~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:624:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
624 | basic_string(const _CharT* __s, size_type __n,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:624:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:604:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
604 | basic_string(const basic_string& __str, size_type __pos,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:604:7: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:586:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
586 | basic_string(const basic_string& __str, size_type __pos,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:586:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:569:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
569 | basic_string(const basic_string& __str, size_type __pos,
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:569:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
552 | basic_string(const basic_string& __str)
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:552:40: note: no known conversion for argument 1 from 'int' to 'const std::__cxx11::basic_string<char>&'
552 | basic_string(const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:540:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:540:34: note: no known conversion for argument 1 from 'int' to 'const std::allocator<char>&'
540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:527:7: note: candidate: |
s700975507 | p03919 | Java | import java.util.*;
public class Main {
static Scanner scanner = new Scanner(System.in);
public static void main(String[]$) {
int h = scanner.nextInt(), w = scanner.nextInt();
for (int i = 1; i <= w; i++) {
for (int j = 0; j < h; j++) {
if (scanner.nextInt().equals("snuke")) {
System.out.println(('A' + j) + i);
}
}
}
}
} | Main.java:10: error: int cannot be dereferenced
if (scanner.nextInt().equals("snuke")) {
^
1 error
|
s461103497 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
char s[10][15][5];
int a,b;
for(int i=0;i<10;i++){
for(int j=0;j<15;j++){
for(int d=0;d<5;d++){
cin>>a[i][j][d];
if(a[i][j][2]=='u')
a=i;
b=j;
}
}
}
switch (a) {
case 0: cout<<'A'<<b<<endl;break;
case 1: cout<<'B'<<b<<endl;break;
case 2: cout<<'C'<<b<<endl;break;
case 3: cout<<'D'<<b<<endl;break;
case 4: cout<<'E'<<b<<endl;break;
case 5: cout<<'F'<<b<<endl;break;
case 6: cout<<'G'<<b<<endl;break;
case 7: cout<<'H'<<b<<endl;break;
case 8: cout<<'I'<<b<<endl;break;
case 9: cout<<'J'<<b<<endl;break;
}
} | a.cc: In function 'int main()':
a.cc:11:15: error: invalid types 'int[int]' for array subscript
11 | cin>>a[i][j][d];
| ^
a.cc:12:13: error: invalid types 'int[int]' for array subscript
12 | if(a[i][j][2]=='u')
| ^
|
s228653688 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
string snake[10][15];
int code1,code2;
for(int i=0;i<10;i++){
for(int j=0;j<15;j++){
if(snake[i][j]=="snuke"){
code1=i;
code2=j;
}
}
}
char line;
switch(code1){
case 0:cout<<A<<code2<<endl;break;
case 1:cout<<B<<code2<<endl;break;
case 2:cout<<C<<code2<<endl;break;
case 3:cout<<D<<code2<<endl;break;
case 4:cout<<E<<code2<<endl;break;
case 5:cout<<F<<code2<<endl;break;
case 6:cout<<G<<code2<<endl;break;
case 7:cout<<H<<code2<<endl;break;
case 8:cout<<I<<code2<<endl;break;
case 9:cout<<J<<code2<<endl;break;
}
} | a.cc: In function 'int main()':
a.cc:18:18: error: 'A' was not declared in this scope
18 | case 0:cout<<A<<code2<<endl;break;
| ^
a.cc:19:18: error: 'B' was not declared in this scope
19 | case 1:cout<<B<<code2<<endl;break;
| ^
a.cc:20:18: error: 'C' was not declared in this scope
20 | case 2:cout<<C<<code2<<endl;break;
| ^
a.cc:21:18: error: 'D' was not declared in this scope
21 | case 3:cout<<D<<code2<<endl;break;
| ^
a.cc:22:18: error: 'E' was not declared in this scope
22 | case 4:cout<<E<<code2<<endl;break;
| ^
a.cc:23:18: error: 'F' was not declared in this scope
23 | case 5:cout<<F<<code2<<endl;break;
| ^
a.cc:24:18: error: 'G' was not declared in this scope
24 | case 6:cout<<G<<code2<<endl;break;
| ^
a.cc:25:18: error: 'H' was not declared in this scope
25 | case 7:cout<<H<<code2<<endl;break;
| ^
a.cc:26:18: error: 'I' was not declared in this scope
26 | case 8:cout<<I<<code2<<endl;break;
| ^
a.cc:27:18: error: 'J' was not declared in this scope
27 | case 9:cout<<J<<code2<<endl;break;
| ^
|
s813467306 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
char snake[10][15];
int code1,code2;
for(int i=0;i<10;i++){
for(int j=0;j<15;j++){
if(snake[i][j]=="snuke"){
code1=i;
code2=j;
}
}
}
char line;
switch(code1){
case 0:cout<<A<<code2<<endl;break;
case 1:cout<<B<<code2<<endl;break;
case 2:cout<<C<<code2<<endl;break;
case 3:cout<<D<<code2<<endl;break;
case 4:cout<<E<<code2<<endl;break;
case 5:cout<<F<<code2<<endl;break;
case 6:cout<<G<<code2<<endl;break;
case 7:cout<<H<<code2<<endl;break;
case 8:cout<<I<<code2<<endl;break;
case 9:cout<<J<<code2<<endl;break;
}
} | a.cc: In function 'int main()':
a.cc:10:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(snake[i][j]=="snuke"){
| ~~~~~~~~~~~^~~~~~~~~
a.cc:18:18: error: 'A' was not declared in this scope
18 | case 0:cout<<A<<code2<<endl;break;
| ^
a.cc:19:18: error: 'B' was not declared in this scope
19 | case 1:cout<<B<<code2<<endl;break;
| ^
a.cc:20:18: error: 'C' was not declared in this scope
20 | case 2:cout<<C<<code2<<endl;break;
| ^
a.cc:21:18: error: 'D' was not declared in this scope
21 | case 3:cout<<D<<code2<<endl;break;
| ^
a.cc:22:18: error: 'E' was not declared in this scope
22 | case 4:cout<<E<<code2<<endl;break;
| ^
a.cc:23:18: error: 'F' was not declared in this scope
23 | case 5:cout<<F<<code2<<endl;break;
| ^
a.cc:24:18: error: 'G' was not declared in this scope
24 | case 6:cout<<G<<code2<<endl;break;
| ^
a.cc:25:18: error: 'H' was not declared in this scope
25 | case 7:cout<<H<<code2<<endl;break;
| ^
a.cc:26:18: error: 'I' was not declared in this scope
26 | case 8:cout<<I<<code2<<endl;break;
| ^
a.cc:27:18: error: 'J' was not declared in this scope
27 | case 9:cout<<J<<code2<<endl;break;
| ^
|
s506205277 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int H,W,cnt=1;
char ans=65
string S;
cin >> H >> W;
for(int i=0;i<H*W;i++){
cin >> S;
if(S!="snuke")
cnt++;
if(cnt==W)
cnt=1,ans++;
if(S=="snuke")
cout << ans << cnt << endl;
}
} | a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'string'
7 | string S;
| ^~~~~~
a.cc:10:12: error: 'S' was not declared in this scope
10 | cin >> S;
| ^
|
s025027961 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
char c;
string d;
for(int i=i;i<a+1;i++){
for(int j=0;j<b;j++){
cin>>d;
if(d=="snuke"){
c='A'+j
cout<<c<<i<<endl;
}
}
}
} | a.cc: In function 'int main()':
a.cc:13:16: error: expected ';' before 'cout'
13 | c='A'+j
| ^
| ;
14 | cout<<c<<i<<endl;
| ~~~~
|
s512054566 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std ;
int main () {
int a = 0 , b = 0 ;
int w , h ;
cin >> w >> h ;
for (int i = 0 ; i < w ; i++ ) {
for (int j = 0 ; j < h ; j++ ) {
string a ;
cin >> a ;
if ( a == "snuke" ) {
a = i ; b = j ;
}
}
}
vector<char> line ;
line = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
cout << line.at(i-1) << j << endl ;
}
| a.cc: In function 'int main()':
a.cc:19:19: error: 'i' was not declared in this scope
19 | cout << line.at(i-1) << j << endl ;
| ^
a.cc:19:27: error: 'j' was not declared in this scope
19 | cout << line.at(i-1) << j << endl ;
| ^
|
s897059352 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std ;
int main () {
int a = 0 , b = 0 ;
int w , h ;
cin >> w >> h ;
for (int i = 0 ; i < w ; i++ ) {
for (int j = 0 ; j < h ; j++ ) {
string a ;
cin >> a ;
if ( a == "snuke" ) {
a = i ; b = j ;
}
}
}
vector<char> line ;
line = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}
cout << line.at(i-1) << j << endl ;
} | a.cc: In function 'int main()':
a.cc:18:115: error: expected ';' before 'cout'
18 | line = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}
| ^
| ;
19 | cout << line.at(i-1) << j << endl ;
| ~~~~
|
s059515929 | p03919 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int h, w;
string s;
int ansi, ansj;
cin >> h >> w;
for ( int i = 0; i < h; i++ ){
for ( int j = 0; j < w; j++){
cin >> s;
if ( s == "snuke" ){
ansi = i;
ansj = j;
}
}
}
char c = 'A' + ansj
cout << c << ansi + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:21:3: error: expected ',' or ';' before 'cout'
21 | cout << c << ansi + 1 << endl;
| ^~~~
|
s948524265 | p03919 | C++ | #include <stdio.h>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
char ans1;
int ans2
int h,w;
cin >> h >> w;
string str[h][w],temp;
for(int i=0; i<h; i++){
for(int j=0; j<w; j++){
cin >> temp;
if(temp=="snuke"){
ans1='A'+j;
ans2=1+i;
}
}
}
cout << ans1 << ans2 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:5: error: expected initializer before 'int'
11 | int h,w;
| ^~~
a.cc:12:12: error: 'h' was not declared in this scope
12 | cin >> h >> w;
| ^
a.cc:12:17: error: 'w' was not declared in this scope
12 | cin >> h >> w;
| ^
a.cc:19:17: error: 'ans2' was not declared in this scope; did you mean 'ans1'?
19 | ans2=1+i;
| ^~~~
| ans1
a.cc:23:21: error: 'ans2' was not declared in this scope; did you mean 'ans1'?
23 | cout << ans1 << ans2 << endl;
| ^~~~
| ans1
|
s343400673 | p03919 | C++ | NG | a.cc:1:1: error: 'NG' does not name a type
1 | NG
| ^~
|
s184954554 | p03919 | C++ | #include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int INTMAX = 2147483647;
const int INTMIN = -2147483648;
const unsigned int UINTMAX = 4294967295;
const long LONGMAX = 9223372036854775807;
const long LONGMIN = -9223372036854775808;
const unsigned long ULONGMAX = 18446744073709551615;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
bool isprime(int p) {
if (p==1) return false;
FOR(i,2,p) {
if (p%i==0) return false;
}
return true;
}
int dig(int n, int a) {return n/(int)pow(10,a)%10;}
int digl(long n, int a) {return n/(long)pow(10,a)%10;}
int digsum(int n) {int r=0;REP(i,10){r+=dig(n,i);}return r;}
int digsuml(long n) {int r=0;REP(i,19){r+=digl(n,i);}return r;}
int dignum(int n) {return n?to_string(n).length():0;}
int dignuml(long n) {return n?to_string(n).length():0;}
int main(){
int h,w;
string s;
cin >> h >> w;
REP1(i,h){
REP(j,w){
cin >> s;
if(s=="snuke"){
cout >> ALP[w] >> h;
}
}
}
} | a.cc:15:23: warning: integer constant is so large that it is unsigned
15 | const long LONGMIN = -9223372036854775808;
| ^~~~~~~~~~~~~~~~~~~
a.cc:16:32: warning: integer constant is so large that it is unsigned
16 | const unsigned long ULONGMAX = 18446744073709551615;
| ^~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:50:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'const char'})
50 | cout >> ALP[w] >> h;
a.cc:50:14: note: candidate: 'operator>>(int, int)' (built-in)
a.cc:50:14: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:50:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
50 | cout >> ALP[w] >> h;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:50:9: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
50 | cout >> ALP[w] >> h;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:50:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
50 | cout >> ALP[w] >> h;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:50:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
50 | cout >> ALP[w] >> h;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:50:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
50 | cout >> ALP[w] >> h;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:50:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
50 | cout >> ALP[w] >> h;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:50:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
50 | cout >> ALP[w] >> h;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:50:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
50 | cout >> ALP[w] >> h;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char&]':
a.cc:50:22: required from here
50 | cout >> ALP[w] >> h;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s614517467 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int h, w;
cin >> h >> w;
int c, r;
for(int i=0;i<h;++i){
for(int j=0;j<w;++j){
string s;
cin >> s;
if(s == "snuke"){
c = j;
r = i;
}
}
}
cout << (char)('A'+c) << j << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:21:28: error: 'j' was not declared in this scope
21 | cout << (char)('A'+c) << j << endl;
| ^
|
s493717119 | p03919 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int h, w;
cin >> h >> w;
string c[h][w];
for(int i = 0;i < h;i++){
for(int j = 0;j < w;j++){
cin >> s[i][j];
if(s[i][j] == "snuke"){
cout << 'A' + j << i + 1 << endl;
return 0;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:14: error: 's' was not declared in this scope
9 | cin >> s[i][j];
| ^
|
s907889170 | p03919 | C++ | #include <iostream>
#include <string>
int main() {
int H, W;
std::string S[30][30];
char str[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
std::cin >> H >> W;
char str[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
std::cin >> S[i][j];
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
if (S[i][j] == "snuke") {
std::cout << str[j] << i << std::endl;
return 0;
}
} | a.cc:13:1: error: extended character is not valid in an identifier
13 |
| ^
a.cc: In function 'int main()':
a.cc:9:14: error: redeclaration of 'char str [26]'
9 | char str[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
| ^~~
a.cc:6:6: note: 'char str [26]' previously declared here
6 | char str[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
| ^~~
a.cc:13:1: error: '\U000000a0' was not declared in this scope
13 |
| ^
a.cc:14:25: error: 'i' was not declared in this scope
14 | for (int i = 0; i < H; i++)
| ^
a.cc:15:33: error: 'j' was not declared in this scope
15 | for (int j = 0; j < W; j++)
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.