submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s179610614
|
p04001
|
C++
|
#include<bits/stdc++.h>
#include<windows.h>
#define ll long long
using namespace std;
int main(){
string s;
cin>>s;
ll ans=0,num=0;
for(int i=0;i<(1<<s.size()-1);i++){
for(int j=0;j<s.size();j++){
num=num*10+s[j]-'0';
if(i & 1<<j){
ans+=num;
num=0;
}
}
ans+=num;
num=0;
}
Sleep(10000);
cout<<ans<<endl;
return 0;
}
|
a.cc:2:9: fatal error: windows.h: No such file or directory
2 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s735392892
|
p04001
|
C++
|
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
string s;
cin>>s;
ll ans=0,num=0;
for(int i=0;i<(1<<s.size()-1);i++){
for(int j=0;j<s.size();j++){
num=num*10+s[j]-'0';
if(i & 1<<j){
ans+=num;
num=0;
}
}
ans+=num;
num=0;
}
Sleep(1000);
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:9: error: 'Sleep' was not declared in this scope; did you mean 'sleep'?
19 | Sleep(1000);
| ^~~~~
| sleep
|
s174501931
|
p04001
|
C++
|
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
int n;
ll ans;
bool flg[12];
string s;
void calc() {
vector<string> v;
int idx = 0;
string tmp;
while (true) {
if (idx > 0 && flg[idx - 1]) {
v.push_back(tmp);
tmp = "";
}
if (idx == n) {
break;
}
tmp += s[idx];
idx++;
}
for (int i = 0; i < v.size(); i++) {
ans += atoll(v[i].c_str());
}
}
void dfs(int idx) {
if (idx == n - 1) {
calc();
return;
}
flg[idx] = true;
dfs(idx + 1);
flg[idx] = false;
dfs(idx + 1);
}
int main() {
while (cin >> s) {
n = s.size();
ans = 0;
memset(flg, 0, sizeof(flg));
flg[n - 1] = true;
dfs(0);
cout << ans << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:53:5: error: 'memset' was not declared in this scope
53 | memset(flg, 0, sizeof(flg));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <cstdlib>
+++ |+#include <cstring>
5 | using namespace std;
|
s375026741
|
p04001
|
C++
|
s = input()
n = len(s)
ans = 0
for i in range(1 << (n-1)):
formula = s[0]
for j in range(n-1):
if (i >> j) & 1 == 1:
formula += s[j+1]
else:
formula += '+' + s[j+1]
ans += eval(formula)
print(ans)
|
a.cc:1:1: error: 's' does not name a type
1 | s = input()
| ^
|
s936770644
|
p04001
|
C++
|
#include <bits/stdc++.h>
#typedef long long ll
using namespace std;
inline ll pow10(ll a){
if(!a)return 1;
return pow10(a-1)*10;
}
int main(){
ll a,ans;
cin>>a;
ans+=a;
ll dig=log10(a)+1;
for(ll i=dig;i>0;i--){
for(ll j=dig-i;j>=0;j--){
ans+=a/pow10(j)%pow10(i)<<i-1;
}
}
cout<<a;
}
|
a.cc:2:2: error: invalid preprocessing directive #typedef
2 | #typedef long long ll
| ^~~~~~~
a.cc:4:8: error: 'll' does not name a type
4 | inline ll pow10(ll a){
| ^~
a.cc: In function 'int main()':
a.cc:9:3: error: 'll' was not declared in this scope
9 | ll a,ans;
| ^~
a.cc:10:8: error: 'a' was not declared in this scope
10 | cin>>a;
| ^
a.cc:11:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | ans+=a;
| ^~~
| abs
a.cc:12:5: error: expected ';' before 'dig'
12 | ll dig=log10(a)+1;
| ^~~~
| ;
a.cc:13:9: error: expected ';' before 'i'
13 | for(ll i=dig;i>0;i--){
| ^~
| ;
a.cc:13:16: error: 'i' was not declared in this scope
13 | for(ll i=dig;i>0;i--){
| ^
a.cc:14:11: error: expected ';' before 'j'
14 | for(ll j=dig-i;j>=0;j--){
| ^~
| ;
a.cc:14:20: error: 'j' was not declared in this scope; did you mean 'jn'?
14 | for(ll j=dig-i;j>=0;j--){
| ^
| jn
a.cc:15:14: error: 'pow10' was not declared in this scope
15 | ans+=a/pow10(j)%pow10(i)<<i-1;
| ^~~~~
|
s081511213
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
long long a;
cin>>a;
a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
cout<<a;
}
|
a.cc: In function 'int main()':
a.cc:6:12: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~^~~~
| | |
| | double
| long long int
a.cc:6:29: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~~~~^~~~
| | |
| | double
| long long int
a.cc:6:35: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~^~~~
| | |
| | double
| long long int
a.cc:6:58: error: invalid operands of types 'double' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~~~~~^~~~
| | |
| | double
| double
a.cc:6:67: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~~~~^~~~
| | |
| | double
| long long int
a.cc:6:73: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~^~~~
| | |
| | double
| long long int
a.cc:6:96: error: invalid operands of types 'double' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~~~~~^~~~
| | |
| | double
| double
a.cc:6:106: error: invalid operands of types 'double' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~~~~~^~~~
| | |
| | double
| double
a.cc:6:115: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~~~~^~~~
| | |
| | double
| long long int
a.cc:6:121: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
| ~^~~~
| | |
| | double
| long long int
a.cc:6:144: error: invalid operands of types 'double' and 'double' to binary 'operator%'
6 | a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
|
|
s849820243
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
ll a;
cin>>a;
a+=a/10+a%1e9+((a/1e2+a/10%1e8+a%1e8)<<1)+((a/1e3+a/1e2%1e7+a/10%1e7+a%1e7)<<2)+((a/1e4+a/1e3%1e6+a/1e2%1e6+a/10%1e6+a%1e6)<<3)+((a/1e5+a/1e4%1e5+a/1e3%1e5+a/1e2%1e5+a/10%1e5+a%1e5)<<4)+((a/1e6+a/1e5%1e4+a/1e4%1e4+a/1e3%1e4+a/1e2%1e4+a/10%1e4+a%1e4)<<5)+((a/1e7+a/1e6%1e3+a/1e5%1e3+a/1e4%1e3+a/1e3%1e3+a/1e2%1e3+a/10%1e3+a%1e3)<<6)+((a/1e8+a/1e7%100+a/1e6%100+a/1e5%100+a/1e4%100+a/1e3%100+a/1e2%100+a/10%100+a%100)<<7)+((a/1e9+a/1e8%10+a/1e7%10+a/1e6%10+a/1e5%10+a/1e4%10+a/1e3%10+a/1e2%10+a/10%10+a%10)<<8);
cout<<a;
}
|
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
4 | ll a;
| ^~
a.cc:5:8: error: 'a' was not declared in this scope
5 | cin>>a;
| ^
|
s457328566
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()
const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;
int main()
{
string s;
cin >> s;
int n = s.size()-1;
ll sol = 0;
for(int bit = 0; bit < (1<<n); bit++){
ll now = 0;
cout << bitset<8>(bit) << endl;
for(int i = 0; i < n+1; i++){
now *= 10;
now += s[i] - '0';
if(!(bit&(1<<i))){ //bitが立ってない -> +があるので加算 bitが立ってる -> +がない
//cout << bitset<8>(bit&(1<<i)) << endl;
cout << now << endl;
sol += now;
now = 0;
}
}
}
cout << sol << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:30:17: error: 'bitset' was not declared in this scope
30 | cout << bitset<8>(bit) << endl;
| ^~~~~~
a.cc:10:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
9 | #include <cmath>
+++ |+#include <bitset>
10 |
a.cc:30:32: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
30 | cout << bitset<8>(bit) << endl;
| ~~~~~~^~~~~~~
|
s205618704
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()
const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;
int main()
{
string s;
cin >> s;
int n = s.size()-1;
ll sol = 0;
for(int bit = 0; bit < (1<<n); bit++){
int now = 0;
cout << bitset<8>(bit) << endl;
for(int i = 0; i < n+1; i++){
now *= 10;
now += s[i] - '0';
if(!(bit&(1<<i))){ //bitが立ってない -> +があるので加算 bitが立ってる -> +がない
//cout << bitset<8>(bit&(1<<i)) << endl;
cout << now << endl;
sol += now;
now = 0;
}
}
}
cout << sol << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:30:17: error: 'bitset' was not declared in this scope
30 | cout << bitset<8>(bit) << endl;
| ^~~~~~
a.cc:10:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
9 | #include <cmath>
+++ |+#include <bitset>
10 |
a.cc:30:32: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
30 | cout << bitset<8>(bit) << endl;
| ~~~~~~^~~~~~~
|
s528674807
|
p04001
|
Java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.util.*;
import static main.Main_1.sc;
/**
*
* @author baito
*/
public class Main
{
static StringBuilder sb = new StringBuilder();
static FastScanner sc = new FastScanner(System.in);
static long N;
static int [] A;
public static void main(String[] args)
{
N = sc.nextLong();
long tempN = N;
int len = length(N);
long sum = 0;
for (int bit = 0; bit < (1 << len - 1); bit++) {
int tempBit = bit;
for (int size = 1; size <= len; size++) {
if(((tempBit >> (size - 1)) & 1) == 1){
sum += N % (int) Math.pow(10,size);
N /= (int)Math.pow(10,size);
len -= size ;
tempBit /= (int)Math.pow(2,size);
size = 0;
}
}
sum += N;
N = tempN;
len = length(N);
}
System.out.println(sum);
}
static int gcd(int n, int r) { return r == 0 ? n : gcd(r, n%r); }
static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n%r); }
static int length(int a) {int cou = 0; while(a != 0){ a /= 10; cou++; } return cou;}
static int length(long a) {int cou = 0; while(a != 0){ a /= 10; cou++; } return cou;}
static <T> void swap(T[] x, int i, int j) { T t = x[i]; x[i] = x[j]; x[j] = t; }
static void swap(int[] x, int i, int j) { int t = x[i]; x[i] = x[j]; x[j] = t; }
static class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
/*public String nextChar(){
return (char)next()[0];
}*/
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
public int [][] nextIntArray2(int h, int w){
int[][] a = new int[h][w];
for(int hi = 0 ; hi < h ; hi++){
for(int wi = 0 ; wi < w ; wi++){
a[hi][wi] = nextInt();
}
}
return a;
}
public Integer[] nextIntegerArray(int n) {
Integer[] a = new Integer[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
public char[] nextCharArray(int n){
char[] a = next().toCharArray();
return a;
}
public char[][] nextCharArray2(int h , int w){
char[][] a = new char[h][w];
for (int i = 0; i < h; i++) {
a[i] = next().toCharArray();
}
return a;
}
public char[][] nextWrapCharArray2(int h , int w){
char[][] a = new char[h + 2][w + 2];
for (int i = 1; i < h + 1; i++) {
a[i] = (" " + next() + " ").toCharArray();
}
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = nextLong();
}
return a;
}
public long [][] nextLongArray2(int h, int w){
long[][] a = new long[h][w];
for(int hi = 0 ; hi < h ; hi++){
for(int wi = 0 ; wi < h ; wi++){
a[h][w] = nextLong();
}
}
return a;
}
}
}
|
Main.java:10: error: package main does not exist
import static main.Main_1.sc;
^
Main.java:10: error: static import only from classes and interfaces
import static main.Main_1.sc;
^
2 errors
|
s176761882
|
p04001
|
C++
|
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<vector>
#define pa pair<int,int>
using namespace std;
const int MAXN=1000010;
int dis[MAXN];
vector <pa> g[MAXN];
vector <int> new_g[MAXN],all[MAXN];
int visit[MAXN],ptr[MAXN];
queue <int> q;
int main()
{
int n,m;
scanf("%d%d",&n,&m);
for (int i=1;i<=m;i++)
{
int u,v,c;
scanf("%d%d%d",&u,&v,&c);
u--,v--;
g[u].push_back(make_pair(c,v));
g[v].push_back(make_pair(c,u));
all[c].push_back(u);
all[c].push_back(v);
}
for (int i=0;i<n;i++)
{
sort(g[i].begin(),g[i].end());
visit[i]=-1;
}
int newn=n;
for (int i=0;i<MAXN;i++)
{
if (all[i].empty())
{
continue;
}
for (int it=0;it<all[i].size();it++)
{
int v=all[i][it];
if (visit[v]==i)
{
continue;
}
visit[v]=i;
new_g[x].push_back(newn);
new_g[newn].push_back(x);
newn++;
}
}
for (int i=0;i<newn;i++)
{
dis[i]=-2;
}
q.push(0);
dis[0]=0;
while (!q.empty())
{
int x=q.front();
q.pop();
for (int i=0;i<new_g[x].size();i++)
{
int u=new_g[x][i];
if (dis[u]==-2)
{
dis[u]=dis[x]+1;
q.push(u);
}
}
}
cout<<dis[n-1]/2;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:54:31: error: 'x' was not declared in this scope
54 | new_g[x].push_back(newn);
| ^
|
s369664444
|
p04001
|
C++
|
(ns Atcoder.ARC061-A)
(def S (read-line))
(def len (count S))
(defn char2int [c]
(- (int c) (int \0))
)
(defn calc [i]
(loop [j 1 now (char2int (nth S 0)) sum 0]
(if (= len j)
(+ sum now)
(if (= (bit-and 1 (bit-shift-right i (dec j))) 1)
(recur (inc j) (char2int (nth S j)) (+ sum now))
(recur (inc j) (+ (* now 10) (char2int (nth S j))) sum)
)
)
)
)
(def ans (reduce + (for [i (range 0 (Math/pow 2 (dec len)))] (calc i))))
(println ans)
|
a.cc:8:19: error: stray '\' in program
8 | (- (int c) (int \0))
| ^
a.cc:1:4: error: expected ')' before 'Atcoder'
1 | (ns Atcoder.ARC061-A)
| ~ ^~~~~~~~
| )
|
s161893456
|
p04001
|
C++
|
s = raw_input()
l = len(s)
ans = 0
for p in range(l):
for q in range(p+1,l+1):
ans += int(s[p:q]) * (2**max(p-1,0)) * (2**max(l-q-1,0))
print ans
|
a.cc:1:1: error: 's' does not name a type
1 | s = raw_input()
| ^
|
s721958750
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
using namespace std;
string S;
long long all_sum = 0;
void search(int i, int j, int sum)
{
if(i == S.length())
{
all_sum += (sum + stoll(S.substr(j)));
}
else
{
search(i+1, i, sum + stoll(S.substr(j, i-j)));
search(i+1, j, sum);
}
}
int main(int argc, char const* argv[])
{
cin >> S;
search(1,0,0);
cout << all_sum << endl;
return 0;
}
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
using namespace std;
string S;
long long all_sum = 0;
void search(int i, int j, int sum)
{
if(i == S.length())
{
all_sum += (sum + stoll(S.substr(j)));
}
else
{
search(i+1, i, sum + stoll(S.substr(j, i-j)));
search(i+1, j, sum);
}
}
int main(int argc, char const* argv[])
{
cin >> S;
search(1,0,0);
cout << all_sum << endl;
return 0;
}
|
a.cc:42:8: error: redefinition of 'std::string S'
42 | string S;
| ^
a.cc:8:8: note: 'std::string S' previously declared here
8 | string S;
| ^
a.cc:44:11: error: redefinition of 'long long int all_sum'
44 | long long all_sum = 0;
| ^~~~~~~
a.cc:10:11: note: 'long long int all_sum' previously defined here
10 | long long all_sum = 0;
| ^~~~~~~
a.cc:46:6: error: redefinition of 'void search(int, int, int)'
46 | void search(int i, int j, int sum)
| ^~~~~~
a.cc:12:6: note: 'void search(int, int, int)' previously defined here
12 | void search(int i, int j, int sum)
| ^~~~~~
a.cc:60:5: error: redefinition of 'int main(int, const char**)'
60 | int main(int argc, char const* argv[])
| ^~~~
a.cc:26:5: note: 'int main(int, const char**)' previously defined here
26 | int main(int argc, char const* argv[])
| ^~~~
|
s850822619
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n,m) for (int i=n; i<m; i++)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible" ) << endl
#define Size(n) (n).size()
bool dfs(int i, int d, long long sum, string s, int l);
long long ssum=0;
int l;
string s;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> s;
l = s.length();
dfs(1,0,0);
cout<<ssum<<endl;
return 0;
}
int dfs(int i, int d, long long sum){
if (i==l){
sum = sum+stoll(s.substr(d,i-d));
ssum += sum;
return 0;
}
else{
dfs(i+1,i,sum+stoll(s.substr(d,i-d)));
dfs(i+1,d,sum);
}
}
|
a.cc: In function 'int main()':
a.cc:30:8: error: too few arguments to function 'bool dfs(int, int, long long int, std::string, int)'
30 | dfs(1,0,0);
| ~~~^~~~~~~
a.cc:16:6: note: declared here
16 | bool dfs(int i, int d, long long sum, string s, int l);
| ^~~
a.cc: In function 'int dfs(int, int, long long int)':
a.cc:43:8: warning: control reaches end of non-void function [-Wreturn-type]
43 | dfs(i+1,d,sum);
| ~~~^~~~~~~~~~~
|
s086647760
|
p04001
|
C++
|
in = input()
print(in)
|
a.cc:1:1: error: 'in' does not name a type; did you mean 'int'?
1 | in = input()
| ^~
| int
|
s680958297
|
p04001
|
C++
|
S=input()
|
a.cc:1:1: error: 'S' does not name a type
1 | S=input()
| ^
|
s167420146
|
p04001
|
C++
|
S=input()
l=len(S)
out = 0;
for i in range(l):
out += int(S[i:l])
|
a.cc:1:1: error: 'S' does not name a type
1 | S=input()
| ^
a.cc:6:1: error: expected unqualified-id before 'for'
6 | for i in range(l):
| ^~~
|
s832463051
|
p04001
|
C++
|
//http://codeforces.com/problemset/problem
#include <string>
#include<iostream >
#include<utility>
#include<cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <deque>
#include <stdio.h>
#include <fstream>
#include <ctime>
#include <cstring>
#include <iomanip>
#include <cassert>
#include <complex>
#include <functional>
#include <list>
#include <bits/stdc++.h>
using namespace std;
char c[12345];
int main ()
{
cin >>c;
int len=strlen(c);
long long ans=0;
for (int t=0;t<(1<<len-1);t++)
{
long long num=c[0]-'0';
for (int i=0;i<len-1;i++)
{
if (t&(1<<i))
{
ans+=num;
num=0;
}
num=num*10+c[i+1]-'0';
}
ans+=num;
}
cout <<ans;
}
|
a.cc:3:9: fatal error: iostream : No such file or directory
3 | #include<iostream >
| ^~~~~~~~~~~
compilation terminated.
|
s427670269
|
p04001
|
C++
|
#include<bits\\stdc++.h>
using namespace std;
char s[12345];
int main(){
scanf("%s",s);
int len=strlen(s);
long long ans=0;
for(int t=0;t<(1<<(len-1));t++){
long long num=s[0]-'0';
for(int i=0;i<len-1;i++){
if(t&(1<<i)){
ans+=num;
num=0;
}
num=num*10+s[i+1]-'0';
}
ans+=num;
}
cout<<ans;
}
|
a.cc:1:9: fatal error: bits\\stdc++.h: No such file or directory
1 | #include<bits\\stdc++.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
|
s757310469
|
p04001
|
C++
|
#include<bits\\stdc++.h>
using namespace std;
int n;
char wcz[1007];
int czy[1007];
long long wyn;
void check(){
czy[n]=1;
long long aktu=0;
for(int i=1;i<=n;i++){
aktu*=10;
aktu+=wcz[i]-'0';
if(czy[i]){
wyn+=aktu;
aktu=0;
}
}
}
void rek(int v){
if(v==n){
check();
return;
}
czy[v]=0;
rek(v+1);
czy[v]=1;
rek(v+1);
}
int main(){
scanf("%s",wcz+1);
while(wcz[n+1])
n++;
rek(1);
printf("%lld\n",wyn);
}
|
a.cc:1:9: fatal error: bits\\stdc++.h: No such file or directory
1 | #include<bits\\stdc++.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
|
s366934603
|
p04001
|
C++
|
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
llong pow(int x, int n) {
llong ans = x;
if (n == 0) return 1;
for(int i = 0; i < n - 1; i++) {
ans *= x;
}
return ans;
}
void swap(int *X, int *Y){
int t = *X; *X = *Y; *Y = t;
}
const static int nmax = 40, abmax = 10;
int dp[nmax + 1][nmax * abmax + 1][nmax * abmax + 1];
int main() {
int n;
cin >> S;
string S;
n = S.length();
llong ans = 0;
rep (i, 1 << (n - 1)) {
llong sum = 0;
llong a = S[0] - '0';
rep (j, n - 1) {
if (i & (1 << j)) {
sum += a;
a = 0;
}
a = a * 10 + S[j + 1] - '0';
}
sum += a;
ans += sum;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:60:12: error: 'S' was not declared in this scope
60 | cin >> S;
| ^
|
s635890124
|
p04001
|
C++
|
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
llong pow(int x, int n) {
llong ans = x;
if (n == 0) return 1;
for(int i = 0; i < n - 1; i++) {
ans *= x;
}
return ans;
}
void swap(int *X, int *Y){
int t = *X; *X = *Y; *Y = t;
}
const static int nmax = 40, abmax = 10;
int dp[nmax + 1][nmax * abmax + 1][nmax * abmax + 1];
int main() {
int n;
string S;
n = strlen(S);
llong ans = 0;
rep (i, 1 << (n - 1)) {
llong sum = 0;
llong a = S[0] - '0';
rep (j, n - 1) {
if (i & (1 << j)) {
sum += a;
a = 0;
}
a = a * 10 + S[j + 1] - '0';
}
sum += a;
ans += sum;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:61:16: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
61 | n = strlen(S);
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:14:
/usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
|
s359583889
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
ll stoll(string s) {
ll res = 0;
for (int i = 0; i < s.size(); i++) {
res = res * 10 + (s[i] - '0');
}
return res;
}
ll dfs(string &s, int p, int w, ll sum) {
if (p + w == s.size()) return sum + stoll(s.substr(p, w));
return dfs(s, p + w, 1, sum + stoll(s.substr(p, w))) + dfs(s, p, w + 1, sum);
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(10);
string s;
cin >> s;
cout << dfs(s, 0, 1, 0) << endl;
return 0;
}
|
a.cc: In function 'll dfs(std::string&, int, int, ll)':
a.cc:16:44: error: call of overloaded 'stoll(std::__cxx11::basic_string<char>)' is ambiguous
16 | if (p + w == s.size()) return sum + stoll(s.substr(p, w));
| ~~~~~^~~~~~~~~~~~~~~~
a.cc:7:4: note: candidate: 'll stoll(std::string)'
7 | ll stoll(string s) {
| ^~~~~
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:4180:3: note: candidate: 'long long int std::__cxx11::stoll(const std::string&, std::size_t*, int)'
4180 | stoll(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~~
a.cc:17:38: error: call of overloaded 'stoll(std::__cxx11::basic_string<char>)' is ambiguous
17 | return dfs(s, p + w, 1, sum + stoll(s.substr(p, w))) + dfs(s, p, w + 1, sum);
| ~~~~~^~~~~~~~~~~~~~~~
a.cc:7:4: note: candidate: 'll stoll(std::string)'
7 | ll stoll(string s) {
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:4180:3: note: candidate: 'long long int std::__cxx11::stoll(const std::string&, std::size_t*, int)'
4180 | stoll(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~~
|
s181162962
|
p04001
|
C++
|
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
#define MAX_S 10
// 入力
char s[MAX_S];
long long ans = 0;
long long arr[MAX_S] = {1, 11, 112, 1124, 11248, 112496, 1124992, 11249984, 112499968, 1124999936};
int main() {
cin >> s;
int le = strlen(s);
for (int i = 0; i < le; ++i) {
ans += arr[le - i - 1] * pow(2, i) * (s[i] - '0');
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:14: error: 'strlen' was not declared in this scope
18 | int le = strlen(s);
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cmath>
+++ |+#include <cstring>
3 | #include <string>
|
s459112209
|
p04001
|
C++
|
#include <iostream>
#include <cmath>
using namespace std;
#define MAX_S 10
// 入力
char s[MAX_S];
long long ans = 0;
long long arr[MAX_S] = {1, 11, 112, 1124, 11248, 112496, 1124992, 11249984, 112499968, 1124999936};
int main() {
cin >> s;
int le = strlen(s);
for (int i = 0; i < le; ++i) {
ans += arr[le - i - 1] * pow(2, i) * (s[i] - '0');
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:14: error: 'strlen' was not declared in this scope
17 | int le = strlen(s);
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cmath>
+++ |+#include <cstring>
3 |
|
s171404370
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
typedef long long ll;
vector<pair<int, int>> edg[100003];
set<pair<int, int>> used;
priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<pair<int, pair<int, int>>>> que;
int main() {
int n, m; cin >> n >> m;
for (int i = 0; i < m; ++i) {
int p, q, c; cin >> p >> q >> c;
--p; --q;
edg[p].push_back({ q, c });
edg[q].push_back({ p, c })
}
que.push({ 0, {0, -1} });
while (!que.empty()) {
int d = que.top().first; pair<int, int> pos = que.top().second;
que.pop();
if (pos.first == n - 1) {
cout << d << endl;
return 0;
}
if (used.count(pos) == 1) continue;
used.insert(pos);
int t = pos.first, c = pos.second;
if (c == -1) {
for (int i = 0; i < (int)edg[t].size(); ++i) {
if (used.count(edg[t][i]) == 1) continue;
que.push({ d + 1, edg[t][i] });
}
}
else {
for (int i = 0; i < (int)edg[t].size(); ++i) {
if (c != edg[t][i].second) {
if (used.count({ t, -1 }) == 1) continue;
que.push({ d,{t, -1} });
}
else {
if (used.count(edg[t][i]) == 1) continue;
que.push({ d, edg[t][i] });
}
}
}
}
cout << -1 << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:27:43: error: expected ';' before '}' token
27 | edg[q].push_back({ p, c })
| ^
| ;
28 | }
| ~
|
s139283810
|
p04001
|
C
|
/*
cat <<EOF >mistaken-paste
*/
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#define BIG 2000000007
#define MOD 1000000007
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 200000
#define M_MAX 200
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
ull s;
ull t;
int32_t c;
} struct_a;
const hw vector8[8] = {
{-1, -1},
{-1, 0},
{-1, +1},
{ 0, -1},
{ 0, +1},
{+1, -1},
{+1, 0},
{+1, +1}
};
ull n, m;
ull h, w;
ull k;
ull vua, vub, vuc, vud, vue, vuf;
sll vsa, vsb, vsc, vsd, vse, vsf;
long double vra, vrb, vrc;
size_t slen;
size_t tlen;
ull a[N_MAX];
// sll a[N_MAX];
// ull a[N_MAX][N_MAX];
// ull wall[N_MAX][M_MAX];
ull b[N_MAX];
// sll b[N_MAX];
// ull b[N_MAX][N_MAX];
// sll b[N_MAX][N_MAX];
ull c[N_MAX];
// char s[N_MAX + 1];
// char t[N_MAX + 1];
// char s[N_MAX][M_MAX + 1];
ull dp[N_MAX];
// sll dp[N_MAX];
// bool dp[N_MAX];
// ull dq[N_MAX];
// ull dp[N_MAX + 1][N_MAX + 1];
// ull dp[N_MAX][M_MAX + 1];
// hw arr[N_MAX];
// hwll arr[N_MAX * 2];
// hw brr[M_MAX];
// ull bitdp[1 << N_MAX];
// ull digitdp[102][ 2][ 2];
// pos less carry
// struct_a arr[N_MAX * 2];
// struct_b brr[N_MAX * 2];
void swap_adj (ull *a, ull *b) {
ull tmp = *b;
*b = *a;
*a = tmp;
return;
}
ull divide (ull a, ull b) {
ull x = MOD - 2;
ull ans = 1;
while (x) {
if (x & 1) ans = (ans * b) % MOD;
b = (b * b) % MOD;
x /= 2;
}
return (a * ans) % MOD;
}
int32_t digits (ull x) {
int32_t i = 1;
while (x >= 10) {
x /= 10;
i++;
}
return i;
}
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
// int32_t nextroute (int32_t arr[]) {
// int32_t i = n - 1;
// int32_t j, x;
// while (arr[i - 1] > arr[i]) i--;
// x = n;
// for (j = i; j < n; j++) {
// if (arr[j] < arr[i - 1]) continue;
// if (x == n || arr[x] > arr[j]) x = j;
// }
// arr[i - 1] ^= arr[x];
// arr[x] ^= arr[i - 1];
// arr[i - 1] ^= arr[x];
// qsort(&arr[i], n - i, sizeof(int32_t), comp);
// return 0;
// }
int32_t targetdig (ull x, int32_t index /* 1-indexed */) {
// static...?
int32_t posmax = digits(x);
if (posmax < index) return -1;
while (posmax > index) {
posmax--;
x /= 10;
}
return x % 10;
}
int32_t charcomp (const char left, const char right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int32_t pcharcomp (const char *left, const char *right) {
return charcomp(*left, *right);
}
int32_t pcharrevcomp (const char *left, const char *right) {
return charcomp(*right, *left);
}
int32_t intcomp (const int32_t left, const int32_t right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int32_t pintcomp (const int32_t *left, const int32_t *right) {
return intcomp(*left, *right);
}
int32_t ullcomp (const ull left, const ull right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int32_t pullcomp (const ull *left, const ull *right) {
return ullcomp(*left, *right);
}
int32_t sllcomp (const sll left, const sll right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int32_t psllcomp (const sll *left, const sll *right) {
return sllcomp(*left, *right);
}
int32_t phwAcomp (const hw *left, const hw *right) {
return intcomp(left->a, right->a);
}
int32_t phwBcomp (const hw *left, const hw *right) {
return intcomp(left->b, right->b);
}
int32_t phwABcomp (const hw *left, const hw *right) {
int32_t x = phwAcomp(left, right);
if (x) return x;
return phwBcomp(left, right);
}
int32_t phwllAcomp (const hwll *left, const hwll *right) {
return sllcomp(left->a, right->a);
}
int32_t phwllBcomp (const hwll *left, const hwll *right) {
return sllcomp(left->b, right->b);
}
int32_t phwllABcomp (const hwll *left, const hwll *right) {
int32_t x = phwllAcomp(left, right);
if (x) return x;
return phwllBcomp(left, right);
}
int32_t pstrAcomp (const struct_a *left, const struct_a *right) {
int32_t x;
if (x = ullcomp(left->t, right->t)) return x;
if (x = ullcomp(left->s, right->s)) return x;
if (x = intcomp(left->c, right->c)) return x;
return 0;
}
int32_t bitlet (char c) {
return (1 << (c - 'a'));
}
ull ullabs (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sllabs (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll nibutanlobo (bool (*func)(sll arg), sll ok, sll ng) {
while (sllabs(ok, ng) > 1) {
sll med = (ok + ng) / 2;
if (func(med)) {
ok = med;
} else {
ng = med;
}
// printf("debug: [%lld %lld)\n", ok, ng);
}
if (!func(ok)) return ok * 2 - ng;
return ok;
}
void printquotient (ull left, ull right) {
const int32_t digits = 20;
printf("%llu.", left / right);
left %= right;
for (int32_t i = 0; i < digits; i++) {
left *= 10;
printf("%1d", left / right);
left %= right;
}
puts("");
return;
}
ull solve () {
sll i, j, ki;
ull result = 0;
// sll result;
ull sum = 0;
ull item;
// qsortの際には"p"ullcompを使う
// if (k % 2 == 0) {
// for (i = 0; i < n; i++) {
// printf("%llu%c", ((i == 0) ? (k / 2 - 1) : (k / 2)), ((i == n - 1) ? '\n' : ' '));
// }
// } else {
// //
// }
slen = strlen(s);
for (i = 0; i < (1 << (slen - 1)); i++) {
item = 0;
ull small = 0;
for (j = 0; j < slen; j++) {
small = (small * 10) + (s[j] - '0');
if (j == slen - 1 || (i & (1 << j))) {
item += small;
small = 0;
}
}
result += item;
}
printf("%llu\n", result);
// puts(s);
return 0;
success:
puts("YES");
// puts("Yes");
// printf("%llu\n", result);
return 0;
fail:
puts("NO");
// puts("No");
// puts("0");
return 1;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
// scanf("%llu%llu", &h, &w);
// scanf("%llu", &n, &m);
// scanf("%llu%llu", &k, &n);
// scanf("%llu%llu%llu%llu", &vua, &vub, &vuc, &vud);
scanf("%s", s);
// scanf("%s", t);
// scanf("%lld%lld", &vsa, &vsb);
// for (i = 0; i < n; i++) {
// scanf("%llu", &a[i]);
// }
// for (i = 0; i < n; i++) {
// scanf("%llu", &a[i]);
// }
// for (i = 0; i < n; i++) {
// scanf("%llu", &b[i]);
// }
// for (i = 0; i < n - 1; i++) {
// scanf("%llu%llu", &arr[i].a, &arr[i].b);
// }
// for (i = 0; i < h; i++) {
// for (j = 0; j < w; j++) {
// scanf("%llu", &a[i][j]);
// }
// }
solve();
// for (i = 0; i < n; i++) {
// // scanf("%llu%llu", &vua, &vub);
// scanf("%s", s);
// solve();
// }
return 0;
}
|
main.c: In function 'solve':
main.c:353:23: error: 's' undeclared (first use in this function)
353 | slen = strlen(s);
| ^
main.c:353:23: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:394:21: error: 's' undeclared (first use in this function)
394 | scanf("%s", s);
| ^
|
s486913063
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
#define MOD 1000000007;
#define PI 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll mod = 1000000007;
string S;
int total = 0;
vector<string> split(const string &str, char sep)
{
std::vector<std::string> v; // 分割結果を格納するベクター
auto first = str.begin(); // テキストの最初を指すイテレータ
while (first != str.end()) { // テキストが残っている間ループ
auto last = first; // 分割文字列末尾へのイテレータ
while (last != str.end() && *last != sep) // 末尾 or セパレータ文字まで進める
++last;
v.push_back(std::string(first, last)); // 分割文字を出力
if (last != str.end())
++last;
first = last; // 次の処理のためにイテレータを設定
}
return v;
}
void count(string s)
{
vector<string> v = split(s, '+');
for (vector<string>::iterator it = v.begin(); it != v.end(); it++)
{
total += stoi(*it);
}
}
void setPlus(int d, string s, int p)
{
if (d == S.size() - 1)
{
count(s);
return;
}
d++;
string t = string(s);
setPlus(d, t.insert(p, "+"), p + 2);
setPlus(d, s, p + 1);
d--;
}
int main()
{
cin >> S;
setPlus(0, S, 1);
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
#define MOD 1000000007;
#define PI 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll mod = 1000000007;
string S;
int total = 0;
vector<string> split(const string &str, char sep)
{
std::vector<std::string> v; // 分割結果を格納するベクター
auto first = str.begin(); // テキストの最初を指すイテレータ
while (first != str.end()) { // テキストが残っている間ループ
auto last = first; // 分割文字列末尾へのイテレータ
while (last != str.end() && *last != sep) // 末尾 or セパレータ文字まで進める
++last;
v.push_back(std::string(first, last)); // 分割文字を出力
if (last != str.end())
++last;
first = last; // 次の処理のためにイテレータを設定
}
return v;
}
void count(string s)
{
vector<string> v = split(s, '+');
for (vector<string>::iterator it = v.begin(); it != v.end(); it++)
{
total += stoi(*it);
}
}
void setPlus(int d, string s, int p)
{
if (d == S.size() - 1)
{
count(s);
return;
}
d++;
string t = string(s);
setPlus(d, t.insert(p, "+"), p + 2);
setPlus(d, s, p + 1);
d--;
}
int main()
{
cin >> S;
setPlus(0, S, 1);
cout << total << endl;
return 0;
}
cout << total << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:80:1: error: a function-definition is not allowed here before '{' token
80 | {
| ^
a.cc:96:1: error: a function-definition is not allowed here before '{' token
96 | {
| ^
a.cc:105:1: error: a function-definition is not allowed here before '{' token
105 | {
| ^
a.cc:118:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
118 | int main()
| ^~
a.cc:118:9: note: remove parentheses to default-initialize a variable
118 | int main()
| ^~
| --
a.cc:118:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:119:1: error: a function-definition is not allowed here before '{' token
119 | {
| ^
|
s043267055
|
p04001
|
C++
|
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int keta(int n){
int ans=0;
while(n>0){
ans++;
n/=10;
}
return ans;
}
int main(void){
string s;
cin>>s;
vector<long long> a(s.size());
for(int i=0;i<s.size();i++){
for(int j=0;j<i;j++){
a[i]+=pow(2,j)*pow(10,i-j);
}
a[i]/=10;
a[i]+=pow(10,keta(a[i]));
a[i]*=pow(2,s.size()-i-1);
}
long long ans=0;
for(int i=0;i<s.size();i++){
ans+=(s[i]-'0')*a[s.size()-i-1];
}
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:20:19: error: 'pow' was not declared in this scope
20 | a[i]+=pow(2,j)*pow(10,i-j);
| ^~~
a.cc:23:15: error: 'pow' was not declared in this scope
23 | a[i]+=pow(10,keta(a[i]));
| ^~~
|
s669885295
|
p04001
|
C++
|
9999999999
12656242944
Program ended with exit code: 0
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 9999999999
| ^~~~~~~~~~
|
s019138142
|
p04001
|
C++
|
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include"math.h"
int main(){
unsigned _int64 S = 0;
unsigned _int64 SS = 0;
int N = 0;
int i = 0, j = 0;
char str[11];
int plus[9] = {};
_int64 stack = 0;
scanf("%s", str);
N = strlen(str);
for (i = 0; i < pow((double)2, N - 1) ; i++){
stack = 0;
S = 0;
if (i != 0){
if (plus[0] == 0){
plus[0] = 1;
}
else{
plus[0] = 0;
if (plus[1] == 0){
plus[1] = 1;
}
else{
plus[1] = 0;
if (plus[2] == 0){
plus[2] = 1;
}
else{
plus[2] = 0;
if (plus[3] == 0){
plus[3] = 1;
}
else{
plus[3] = 0;
if (plus[4] == 0){
plus[4] = 1;
}
else{
plus[4] = 0;
if (plus[5] == 0){
plus[5] = 1;
}
else{
plus[5] = 0;
if (plus[6] == 0){
plus[6] = 1;
}
else{
plus[6] = 0;
if (plus[7] == 0){
plus[7] = 1;
}
else{
plus[7] = 0;
if (plus[8] == 0){
plus[8] = 1;
}
}
}
}
}
}
}
}
}
}
/*
for (j = 0; j < N - 1;j++){
printf("%d ",plus[j]);
}
printf("\n");
*/
stack += (str[0]-'0');
for (j = 1; j < N; j++){
if (plus[j - 1] == 0){
stack = stack * 10 + (str[j]-'0');
}
else{
S += stack;
//printf("%d ", stack);
stack = (str[j]-'0');
}
}
//printf("%d \n",stack);
S += stack;
//printf("%d\n",S);
SS += S;
//printf("%d\n", SS);
}
printf("%d", SS);
}
|
a.cc: In function 'int main()':
a.cc:9:25: error: expected initializer before 'S'
9 | unsigned _int64 S = 0;
| ^
a.cc:10:25: error: expected initializer before 'SS'
10 | unsigned _int64 SS = 0;
| ^~
a.cc:16:9: error: '_int64' was not declared in this scope; did you mean 'sinf64'?
16 | _int64 stack = 0;
| ^~~~~~
| sinf64
a.cc:23:17: error: 'stack' was not declared in this scope; did you mean 'obstack'?
23 | stack = 0;
| ^~~~~
| obstack
a.cc:24:17: error: 'S' was not declared in this scope
24 | S = 0;
| ^
a.cc:101:17: error: 'SS' was not declared in this scope
101 | SS += S;
| ^~
a.cc:106:22: error: 'SS' was not declared in this scope
106 | printf("%d", SS);
| ^~
|
s678435426
|
p04001
|
C++
|
#include"stdio.h"
#include"stdlib.h"
#include"string"
int flag(int plus[], int N){
int S = 1;
for (int i = 0; i < N - 1; i++){
S *= plus[i];
}
return S;
}
int main(){
long long int S = 0;
long long int SS = 0;
int N = 0;
int i = 0, j = 0;
char str[10];
int plus[9] = {};
int data[10] = {};
int stack = 0;
scanf("%s", str);
N = strlen(str);
for (i = 0; i < pow(2, N - 1) ; i++){
stack = 0;
S = 0;
if (i != 0){
if (plus[0] == 0){
plus[0] = 1;
}
else{
plus[0] = 0;
if (plus[1] == 0){
plus[1] = 1;
}
else{
plus[1] = 0;
if (plus[2] == 0){
plus[2] = 1;
}
else{
plus[2] = 0;
if (plus[3] == 0){
plus[3] = 1;
}
else{
plus[3] = 0;
if (plus[4] == 0){
plus[4] = 1;
}
else{
plus[4] = 0;
if (plus[5] == 0){
plus[5] = 1;
}
else{
plus[5] = 0;
if (plus[6] == 0){
plus[6] = 1;
}
else{
plus[6] = 0;
if (plus[7] == 0){
plus[7] = 1;
}
else{
plus[7] = 0;
if (plus[8] == 0){
plus[8] = 1;
}
}
}
}
}
}
}
}
}
}
for (j = 0; j < N - 1; j++){
}
stack += (str[0]-48);
for (j = 1; j < N; j++){
if (plus[j - 1] == 0){
stack = stack * 10 + (str[j]-48);
}
else{
S += stack;
stack = (str[j]-48);
}
}
S += stack;
SS += S;
}
printf("%d", SS);
}
|
a.cc: In function 'int main()':
a.cc:25:13: error: 'strlen' was not declared in this scope
25 | N = strlen(str);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include"string"
+++ |+#include <cstring>
4 |
a.cc:28:25: error: 'pow' was not declared in this scope
28 | for (i = 0; i < pow(2, N - 1) ; i++){
| ^~~
|
s018029376
|
p04001
|
C++
|
#include"stdio.h"
#include"stdlib.h"
#include"string"
int flag(int plus[], int N){
int S = 1;
for (int i = 0; i < N - 1; i++){
S *= plus[i];
}
return S;
}
int main(){
long long int S = 0;
long long int SS = 0;
int N = 0;
int i = 0, j = 0;
char str[10];
int plus[9] = {};
int data[10] = {};
int stack = 0;
scanf("%s", str);
N = strlen(str);
for (i = 0; i < pow(2, N - 1) ; i++){
stack = 0;
S = 0;
if (i != 0){
if (plus[0] == 0){
plus[0] = 1;
}
else{
plus[0] = 0;
if (plus[1] == 0){
plus[1] = 1;
}
else{
plus[1] = 0;
if (plus[2] == 0){
plus[2] = 1;
}
else{
plus[2] = 0;
if (plus[3] == 0){
plus[3] == 1;
}
else{
plus[3] = 0;
if (plus[4] == 0){
plus[4] == 1;
}
else{
plus[4] = 0;
if (plus[5] == 0){
plus[5] == 1;
}
else{
plus[5] = 0;
if (plus[6] == 0){
plus[6] == 1;
}
else{
plus[6] = 0;
if (plus[7] == 0){
plus[7] == 1;
}
else{
plus[7] = 0;
if (plus[8] == 0){
plus[8] == 1;
}
}
}
}
}
}
}
}
}
}
for (j = 0; j < N - 1; j++){
}
stack += (str[0]-48);
for (j = 1; j < N; j++){
if (plus[j - 1] == 0){
stack = stack * 10 + (str[j]-48);
}
else{
S += stack;
stack = (str[j]-48);
}
}
S += stack;
SS += S;
}
printf("%d", SS);
}
|
a.cc: In function 'int main()':
a.cc:25:13: error: 'strlen' was not declared in this scope
25 | N = strlen(str);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include"string"
+++ |+#include <cstring>
4 |
a.cc:28:25: error: 'pow' was not declared in this scope
28 | for (i = 0; i < pow(2, N - 1) ; i++){
| ^~~
|
s349888422
|
p04001
|
C++
|
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ld double
#define ll long long
#define int long long
using namespace std;
const int MAXN = 301 * 1001 , MOD = 1e9 + 7 , sq = 333 ;
unordered_map < int , int > d[MAXN];
unordered_map < int , vector < int> > adj2[MAXN] ;
int dis[MAXN] ;
int mark[MAXN] ;
vector < pair < int , int > > adj[MAXN];
int32_t main()
{
ios::sync_with_stdio(0);cin.tie(0);
int n ,m ;
cin >> n >> m ;
for(int i = 0 ; i < m ; i ++ )
{
int x ,y , z ;
cin >> x >> y >> z ;
adj[x].pb({y,z});
adj[y].pb({x,z});
adj2[x][z].pb(y);
adj2[y][z].pb(x);
}
dis[1] = 1 ;
deque<pair<int,int> > q ;
for(auto u : adj[1])
{
q.push_back({u.F,u.S}) ;
q.push_back({1,u.S}) ;
d[u.F][u.S] = 1 ;
d[1][u.S] = 1 ;
}
while(q.size())
{
int x = q.front().F ;
int c = q.front().S ;
q.pop_front() ;
if(!dis[x])
dis[x] = d[x][c] ;
if(dis[x]>dis[x][c])
continue;
if(dis[x]==d[x][c])
{
for(auto u : adj2[x][c])
{
pair<int,int> v = {u,c};
if(d[v.F][v.S]>d[x][c]||!d[v.F][v.S])
{
d[v.F][v.S] = d[x][c] ;
q.push_front({v.F,v.S});
}
}
}
if(dis[x]>d[x][c]||mark[x]>2)
continue ;
mark[x] ++ ;
for(auto v : adj[x] )
{
if(v.S==c)
{
if(d[v.F][v.S]>d[x][c]||!d[v.F][v.S])
{
d[v.F][v.S] = d[x][c] ;
q.push_front({v.F,v.S});
}
}
else
{
if(d[v.F][v.S]>d[x][c] + 1||!d[v.F][v.S])
{
d[v.F][v.S] = d[x][c] + 1 ;
q.push_back({v.F,v.S});
}
}
}
}
if(!dis[n])
return cout<<-1,0;
cout<<dis[n] ;
}
|
a.cc: In function 'int32_t main()':
a.cc:56:25: error: invalid types 'long long int[long long int]' for array subscript
56 | if(dis[x]>dis[x][c])
| ^
|
s126351023
|
p04001
|
C++
|
/**
* @Author Mehdi Maick
* Created on 10/12/2016.
*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
public static void solve(FastReader fs, PrintWriter pw) {
char[] s = fs.next().toCharArray();
long ans = 0;
int n = s.length;
for (int i = 0; i < (1 << n - 1); i++) {
long sum = s[0] - '0';
for (int j = 0; j < n - 1; j++) {
if ((i & (1 << j)) != 0) {
ans += sum;
sum = 0;
}
sum = sum * 10 + s[j + 1] - '0';
}
ans += sum;
}
pw.println(ans);
}
public static void main(String[] args) throws Exception {
FastReader fs = new FastReader(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
solve(fs, pw);
fs.close();
pw.close();
}
static class FastReader {
BufferedReader reader;
StringTokenizer st;
FastReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
st = null;
}
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
String line = reader.readLine();
if (line == null) {
return null;
}
st = new StringTokenizer(line);
} catch (Exception e) {
throw new RuntimeException();
}
}
return st.nextToken();
}
String nextLine() {
String s = null;
try {
s = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return s;
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
char nextChar() {
return next().charAt(0);
}
int[] nextIntArray(int n) {
int[] arr = new int[n];
int i = 0;
while (i < n) {
arr[i++] = nextInt();
}
return arr;
}
long[] nextLongArray(int n) {
long[] arr = new long[n];
int i = 0;
while (i < n) {
arr[i++] = nextLong();
}
return arr;
}
int[] nextIntArrayOneBased(int n) {
int[] arr = new int[n + 1];
int i = 1;
while (i <= n) {
arr[i++] = nextInt();
}
return arr;
}
long[] nextLongArrayOneBased(int n) {
long[] arr = new long[n + 1];
int i = 1;
while (i <= n) {
arr[i++] = nextLong();
}
return arr;
}
void close() {
try {
reader.close();
} catch (IOException e) {
System.err.println("There's been an error trying closing the reader ");
e.printStackTrace();
}
}
}
}
|
a.cc:7:1: error: 'import' does not name a type
7 | import java.util.*;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import java.io.*;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
10 | import static java.lang.Math.*;
| ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:12:1: error: expected unqualified-id before 'public'
12 | public class Main {
| ^~~~~~
|
s218021890
|
p04001
|
C++
|
#include <cstdio>
#include <cstdlib>
#include <typeinfo>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define MAX_L (10)
char S[MAX_L + 1];
void print_array(int *ar, int n) {
for (size_t i = 0; i < n; i++) {
printf("%d ", ar[i]);
}
printf("\n");
}
ll my_atoi(char *s, int l, int r) {
ll val = 0;
for (size_t i = l; i < r; i++) {
val = 10 * val + (s[i] - '0');
}
return val;
}
ll comb(int n, int k) {
ll c = 1;
for (size_t i = k + 1; i <= n; i++) {
c *= i;
}
for (size_t i = 2; i <= n - k; i++) {
c /= i;
}
return c;
}
ll search(char *s, int n, int l, int r) {
// printf("%lld, %d\n", my_atoi(s, l, r), n);
if (n <= 0) { return my_atoi(s, l, r); }
ll cost = 0;
for (size_t i = l + 1; n - 1 < r - i; i++) {
cost += search(s, 0, l, i) * comb(r - i - 1, n - 1);
cost += search(s, n - 1, i, r);
}
return cost;
}
int main() {
scanf("%s", S);
ll cost = 0;
int L = strlen(S);
for (size_t i = 0; i < L; i++) {
cost += search(S, i, 0, L);
}
printf("%lld\n", cost);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:57:11: error: 'strlen' was not declared in this scope
57 | int L = strlen(S);
| ^~~~~~
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <algorithm>
+++ |+#include <cstring>
7 |
|
s945714494
|
p04001
|
C++
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
static BufferedReader br;
public static void main(String[] args) {
try {
br = new BufferedReader(new InputStreamReader(System.in));
String S = br.readLine();
double length = S.length();
double sum = 0;
for (int i = 0; i < length; i++) {
double left = Math.ceil(Math.pow(2, i - 1));
for (int j = i + 1; j < length + 1; j++) {
String s = S.substring(i, j);
double n = Double.valueOf(s);
double right = Math.ceil(Math.pow(2, length - j - 1));
sum += left * n * right;
}
}
System.out.println(sum);
} catch (Exception e) {
System.err.println("Error : " + e.getMessage());
}
}
}
|
a.cc:1:1: error: 'import' does not name a type
1 | import java.io.BufferedReader;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.InputStreamReader;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:16: error: 'BufferedReader' does not name a type
5 | static BufferedReader br;
| ^~~~~~~~~~~~~~
a.cc:7:15: error: expected ':' before 'static'
7 | public static void main(String[] args) {
| ^~~~~~~
| :
a.cc:7:33: error: 'String' has not been declared
7 | public static void main(String[] args) {
| ^~~~~~
a.cc:7:42: error: expected ',' or '...' before 'args'
7 | public static void main(String[] args) {
| ^~~~
a.cc:29:2: error: expected ';' after class definition
29 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:9:25: error: 'br' was not declared in this scope
9 | br = new BufferedReader(new InputStreamReader(System.in));
| ^~
a.cc:9:34: error: expected type-specifier before 'BufferedReader'
9 | br = new BufferedReader(new InputStreamReader(System.in));
| ^~~~~~~~~~~~~~
a.cc:10:25: error: 'String' was not declared in this scope
10 | String S = br.readLine();
| ^~~~~~
a.cc:11:41: error: 'S' was not declared in this scope
11 | double length = S.length();
| ^
a.cc:14:47: error: 'Math' was not declared in this scope
14 | double left = Math.ceil(Math.pow(2, i - 1));
| ^~~~
a.cc:16:48: error: expected ';' before 's'
16 | String s = S.substring(i, j);
| ^
a.cc:17:52: error: 'Double' was not declared in this scope; did you mean 'double'?
17 | double n = Double.valueOf(s);
| ^~~~~~
| double
a.cc:17:67: error: 's' was not declared in this scope
17 | double n = Double.valueOf(s);
| ^
a.cc:22:25: error: 'System' was not declared in this scope
22 | System.out.println(sum);
| ^~~~~~
a.cc:23:26: error: 'Exception' does not name a type
23 | } catch (Exception e) {
| ^~~~~~~~~
a.cc:24:25: error: 'System' was not declared in this scope
24 | System.err.println("Error : " + e.getMessage());
| ^~~~~~
a.cc:24:57: error: 'e' was not declared in this scope
24 | System.err.println("Error : " + e.getMessage());
| ^
|
s028629265
|
p04001
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
const int N = 100010;
int a[N], b[N];
map<pair<int, int> , int> hash;
long long ans[10];
int cal(int x, int y) {
int res = 0;
for (int i = x; i <= x + 2; i++)
for (int j = y; j <= y + 2; j++)
if (hash.find(make_pair(i, j)) != hash.end()) {
res++;
}
return res;
}
int main() {
int m, n, k;
scanf("%d %d %d", &m, &n, &k);
for (int i = 1; i <= k; i++) {
scanf("%d %d", &a[i], &b[i]);
hash[make_pair(a[i], b[i])] = 1;
}
for (int i = 1; i <= k; i++) {
for (int x = max(1, a[i] - 2); x <= a[i]; x++)
for (int y = max(1, b[i] - 2); y <= b[i]; y++) {
if (x + 2 > m || y + 2 > n) continue;
int d = cal(x, y);
ans[d] ++;
}
}
ans[0] = (long long)(m - 2) * (n - 2);
for (int i = 1; i <= 9; i++) {
ans[i] /= i;
ans[0] -= ans[i];
}
for (int i = 0; i <= 9; i++)
printf("%lld\n", ans[i]);
return 0;
}
|
a.cc: In function 'int cal(int, int)':
a.cc:19:29: error: reference to 'hash' is ambiguous
19 | if (hash.find(make_pair(i, j)) != hash.end()) {
| ^~~~
In file included from /usr/include/c++/14/string_view:50,
from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:12:27: note: 'std::map<std::pair<int, int>, int> hash'
12 | map<pair<int, int> , int> hash;
| ^~~~
a.cc:19:59: error: reference to 'hash' is ambiguous
19 | if (hash.find(make_pair(i, j)) != hash.end()) {
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:12:27: note: 'std::map<std::pair<int, int>, int> hash'
12 | map<pair<int, int> , int> hash;
| ^~~~
a.cc: In function 'int main()':
a.cc:30:17: error: reference to 'hash' is ambiguous
30 | hash[make_pair(a[i], b[i])] = 1;
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:12:27: note: 'std::map<std::pair<int, int>, int> hash'
12 | map<pair<int, int> , int> hash;
| ^~~~
|
s534796907
|
p04001
|
C++
|
dp=["","+"]
s=input()
su=0
for i in range(2**(len(s)-1)):
val=""
for j in range(len(s)-1):
val+=s[j]
val+=dp[int(bin(i)[j+2])]
val+=s[len(s)-1]
su+=eval(val)
print(su)
|
a.cc:1:1: error: 'dp' does not name a type
1 | dp=["","+"]
| ^~
|
s546077838
|
p04001
|
Java
|
import java.util.Scanner;
public class main{
static int[] fact = new int[10];
static int[] sum = new int[10];
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
long[] num = new long[str.length()];
for(int i=0; i<str.length(); i++){
num[i] = str.charAt(i) - '0';
}
Factrial();
int bfr = 0, aft = str.length()-1;
long ans = 0;
while(aft>-1){
for(int i=aft; i>=0; i--){
ans += num[bfr]*fact[(i>0)?i-1:0]*fact[bfr];
num[bfr] *= 10;
}
bfr++;
aft--;
}
System.out.println(ans);
}
public static void Factrial(){
fact[0] = 1;
sum[0] = fact[0];
for(int i=1; i<10; i++){
fact[i] = fact[i-1]*2;
sum[i] = sum[i-1]+fact[i];
}
}
}
|
Main.java:3: error: class main is public, should be declared in a file named main.java
public class main{
^
1 error
|
s445344906
|
p04001
|
C++
|
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define GETBIT(X, Data) ((Data >> (X)) & 0x01)
#define SETBIT_ON(X, Data) ((0x01 << (X)) | Data)
#define SETBIT_OFF(X, Data) ((~(0x01 << (X))) & Data)
unsigned long long SubInt(const int& s, const int& e, const string& input)
{
char str[20] = { 0 };
memcpy(str, &input[s], e - s + 1);
return atoll(str);
}
unsigned long long SolveOptStr(const int& opts, const string& input)
{
int s, e;
unsigned long long r;
s = 0;
e = 0;
r = 0;
for (size_t i = 0; i < input.length(); ++i)
{
int k = GETBIT(input.length() - 1 - i, opts);
if (GETBIT(input.length() - 1 - i, opts) == 0)
{
++e;
continue;
}
r += SubInt(s, e, input);
s = i + 1;
e = i + 1;
}
return r;
}
void InitOpts(int& opts)
{
opts = 0x01;
}
void OptsPlus(int& opts)
{
opts = (((opts >> 1) + 1) << 1) | 0x01;
}
int main(int argc, char* argv[])
{
string S;
cin >> S;
int opts;
InitOpts(opts);
unsigned long long res = 0;
size_t loop = (size_t)pow(2, S.length() - 1);
for (size_t i = 0; i < loop; ++i)
{
res += SolveOptStr(opts, S);
OptsPlus(opts);
}
cout << res << endl;
return 0;
}
|
a.cc: In function 'long long unsigned int SubInt(const int&, const int&, const std::string&)':
a.cc:15:9: error: 'memcpy' was not declared in this scope
15 | memcpy(str, &input[s], e - s + 1);
| ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <vector>
+++ |+#include <cstring>
4 | #include <string>
a.cc: In function 'int main(int, char**)':
a.cc:62:31: error: 'pow' was not declared in this scope
62 | size_t loop = (size_t)pow(2, S.length() - 1);
| ^~~
|
s526660745
|
p04001
|
C++
|
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define GETBIT(X, Data) ((Data >> (X)) & 0x01)
#define SETBIT_ON(X, Data) ((0x01 << (X)) | Data)
#define SETBIT_OFF(X, Data) ((~(0x01 << (X))) & Data)
unsigned long long SubInt(const int& s, const int& e, const string& input)
{
char str[20] = { 0 };
memcpy(str, &input[s], e - s + 1);
return _atoi64(str);
}
unsigned long long SolveOptStr(const int& opts, const string& input)
{
int s, e;
unsigned long long r;
s = 0;
e = 0;
r = 0;
for (size_t i = 0; i < input.length(); ++i)
{
int k = GETBIT(input.length() - 1 - i, opts);
if (GETBIT(input.length() - 1 - i, opts) == 0)
{
++e;
continue;
}
r += SubInt(s, e, input);
s = i + 1;
e = i + 1;
}
return r;
}
void InitOpts(int& opts)
{
opts = 0x01;
}
void OptsPlus(int& opts)
{
opts = (((opts >> 1) + 1) << 1) | 0x01;
}
int main(int argc, char* argv[])
{
string S;
cin >> S;
int opts;
InitOpts(opts);
unsigned long long res = 0;
size_t loop = (size_t)pow(2, S.length() - 1);
for (size_t i = 0; i < loop; ++i)
{
res += SolveOptStr(opts, S);
OptsPlus(opts);
}
cout << res << endl;
return 0;
}
|
a.cc: In function 'long long unsigned int SubInt(const int&, const int&, const std::string&)':
a.cc:14:9: error: 'memcpy' was not declared in this scope
14 | memcpy(str, &input[s], e - s + 1);
| ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | #include <string>
a.cc:15:16: error: '_atoi64' was not declared in this scope; did you mean 'atoi'?
15 | return _atoi64(str);
| ^~~~~~~
| atoi
a.cc: In function 'int main(int, char**)':
a.cc:61:31: error: 'pow' was not declared in this scope
61 | size_t loop = (size_t)pow(2, S.length() - 1);
| ^~~
|
s322237156
|
p04001
|
C++
|
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define GETBIT(X, Data) ((Data >> (X)) & 0x01)
#define SETBIT_ON(X, Data) ((0x01 << (X)) | Data)
#define SETBIT_OFF(X, Data) ((~(0x01 << (X))) & Data)
unsigned long long SubInt(const int& s, const int& e, const string& input)
{
char str[20] = { 0 };
memcpy(str, &input[s], e - s + 1);
return _atoi64(str);
}
unsigned long long SolveOptStr(const int& opts, const string& input)
{
int s, e;
unsigned long long r;
s = 0;
e = 0;
r = 0;
for (size_t i = 0; i < input.length(); ++i)
{
int k = GETBIT(input.length() - 1 - i, opts);
if (GETBIT(input.length() - 1 - i, opts) == 0)
{
++e;
continue;
}
r += SubInt(s, e, input);
s = i + 1;
e = i + 1;
}
return r;
}
void InitOpts(int& opts)
{
opts = 0x01;
}
void OptsPlus(int& opts)
{
opts = (((opts >> 1) + 1) << 1) | 0x01;
}
int main(int argc, char* argv[])
{
string S;
cin >> S;
int opts;
InitOpts(opts);
unsigned long long res = 0;
size_t loop = (size_t)pow(2, S.length() - 1);
for (size_t i = 0; i < loop; ++i)
{
res += SolveOptStr(opts, S);
OptsPlus(opts);
}
cout << res << endl;
return 0;
}
|
a.cc: In function 'long long unsigned int SubInt(const int&, const int&, const std::string&)':
a.cc:14:9: error: 'memcpy' was not declared in this scope
14 | memcpy(str, &input[s], e - s + 1);
| ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | #include <string>
a.cc:15:16: error: '_atoi64' was not declared in this scope; did you mean 'atoi'?
15 | return _atoi64(str);
| ^~~~~~~
| atoi
a.cc: In function 'int main(int, char**)':
a.cc:61:31: error: 'pow' was not declared in this scope
61 | size_t loop = (size_t)pow(2, S.length() - 1);
| ^~~
|
s898319423
|
p04001
|
C++
|
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define GETBIT(X, Data) ((Data >> (X)) & 0x01)
#define SETBIT_ON(X, Data) ((0x01 << (X)) | Data)
#define SETBIT_OFF(X, Data) ((~(0x01 << (X))) & Data)
unsigned __int64 SubInt(const int& s, const int& e, const string& input)
{
char str[20] = { 0 };
memcpy(str, &input[s], e - s + 1);
return _atoi64(str);
}
unsigned __int64 SolveOptStr(const int& opts, const string& input)
{
int s, e;
unsigned __int64 r;
s = 0;
e = 0;
r = 0;
for (size_t i = 0; i < input.length(); ++i)
{
int k = GETBIT(input.length() - 1 - i, opts);
if (GETBIT(input.length() - 1 - i, opts) == 0)
{
++e;
continue;
}
r += SubInt(s, e, input);
s = i + 1;
e = i + 1;
}
return r;
}
void InitOpts(int& opts)
{
opts = 0x01;
}
void OptsPlus(int& opts)
{
opts = (((opts >> 1) + 1) << 1) | 0x01;
}
int main(int argc, char* argv[])
{
string S;
cin >> S;
int opts;
InitOpts(opts);
unsigned __int64 res = 0;
size_t loop = (size_t)pow(2, S.length() - 1);
for (size_t i = 0; i < loop; ++i)
{
res += SolveOptStr(opts, S);
OptsPlus(opts);
}
cout << res << endl;
return 0;
}
|
a.cc:11:18: error: expected initializer before 'SubInt'
11 | unsigned __int64 SubInt(const int& s, const int& e, const string& input)
| ^~~~~~
a.cc:18:18: error: expected initializer before 'SolveOptStr'
18 | unsigned __int64 SolveOptStr(const int& opts, const string& input)
| ^~~~~~~~~~~
a.cc: In function 'int main(int, char**)':
a.cc:60:26: error: expected initializer before 'res'
60 | unsigned __int64 res = 0;
| ^~~
a.cc:61:31: error: 'pow' was not declared in this scope
61 | size_t loop = (size_t)pow(2, S.length() - 1);
| ^~~
a.cc:64:17: error: 'res' was not declared in this scope
64 | res += SolveOptStr(opts, S);
| ^~~
a.cc:64:24: error: 'SolveOptStr' was not declared in this scope
64 | res += SolveOptStr(opts, S);
| ^~~~~~~~~~~
a.cc:68:17: error: 'res' was not declared in this scope
68 | cout << res << endl;
| ^~~
|
s228859513
|
p04001
|
C++
|
あsdfghjkl
|
a.cc:1:1: error: '\U00003042sdfghjkl' does not name a type
1 | あsdfghjkl
| ^~~~~~~~~~
|
s988818728
|
p04001
|
C++
|
s = input()
int_s = [int(i) for i in s]
l = len(int_s)
total_patterns = 2 << (l - 2)
def calc_sum(s):
# '+'を区切りとして和を求める
num = s.split('+')
return sum(list(map(int, num)))
ans = 0
for i in range(total_patterns):
between = format(i,'b').zfill(l - 1) # 10進数を2進数に変換
tmp = ''
for j in range(len(between)):
if between[j] == '1':
tmp += (s[j] + '+')
else:
tmp += s[j]
tmp += s[-1]
ans += calc_sum(tmp)
print(ans)
|
a.cc:8:7: error: invalid preprocessing directive #'+'を区切りとして和を求める
8 | # '+'を区切りとして和を求める
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:42: error: stray '#' in program
14 | between = format(i,'b').zfill(l - 1) # 10進数を2進数に変換
| ^
a.cc:15:11: error: empty character constant
15 | tmp = ''
| ^~
a.cc:1:1: error: 's' does not name a type
1 | s = input()
| ^
|
s085162333
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) (void)0
#endif
#define mp make_pair
#define pb push_back
#define LL long long
#define pii pair<int,int>
#define PII pair<long long, long long>
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
const int inf = 0x7fffffff; //beware overflow
const LL INF = 0x7fffffffffffffff; //beware overflow
#define mem(x, y) memset(x, (y), sizeof(x) );
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A,B> &p) {
return s<<"("<<p.first<<","<<p.second<<")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
s << "[ ";
for (auto it : c) s << it << " ";
s << "]";
return s;
}
template<typename T>
ostream& operator << (ostream &o, const set<T> &st) {
o << "{";
for (auto it=st.begin(); it!=st.end(); it++) o << (it==st.begin() ? "" : ", ") << *it;
return o << "}";
}
template<typename T1, typename T2>
ostream& operator << (ostream &o, const map<T1, T2> &mp) {
o << "{";
for (auto it=mp.begin(); it!=mp.end(); it++) {
o << (it==mp.begin()?"":", ") << it->fi << ":" << it->se;
}
o << "}";
return o;
}
#define maxn 100005
int n, m;
struct edge{ int u, v, c; };
vector<edge> e;
vector<int> G[maxn];
int d[maxn];
set<int> Prev[maxn];
struct state{
int d;
int u;
bool operator < (const state& rhs) const {
return d < rhs.d;
}
};
int main() {
cin>>n>>m;
for(int i = 0; i < m; i++) {
int p, q, c;
scanf("%d %d %d", &p, &q, &c);
G[p].pb( SZ(e) );
G[q].pb( SZ(e) );
e.pb( edge{p, q, c} );
}
fill(d, d+1+n, 1e9);
d[1] = 0;
priority_queue<state> que;
que.push( state{ 0,1} );
while(!que.empty() ) {
state tp = que.top(); que.pop();
int u = tp.u;
if( -tp.d > d[u] ) continue;
for( int e_ind : G[u] ) {
int D = -dis[u];
int v = (e[e_ind].u==u)? e[e_ind].v:e[e_ind].u;
int now = D + !Prev[u].count( e[e_ind].c);
if( now < d[v] )
d[v] = now,
Prev[v].clear(),
Prev[v].insert(e[e_ind].c),
que.push( state{ -d[v], v } );
else if (now == d[v])
Prev[v].insert( e[e_ind].c ) ;
}
}
if( d[n] == 1e9 ) puts("-1");
else cout<<d[n]<<endl;
}
|
a.cc: In function 'int main()':
a.cc:80:25: error: 'dis' was not declared in this scope; did you mean 'div'?
80 | int D = -dis[u];
| ^~~
| div
|
s605430341
|
p04001
|
C++
|
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <random>
#include <chrono>
#include <bitset>
#include <fstream>
#include <sstream>
using namespace std;
typedef long long ll;
typedef long double ld;
ll big = 1000000007ll;
float likeabutterfly;
string likeabee;
ll n,m,q,h,k,w;
ll T;
ll mod(ll i){
if(i < 0)return mod(i+big*big);
if(i < big)return i;
return i%big;
}
ll upp(ll i, ll j){
if(j == 0)return 1;
if(j%2 == 0){
ll h = upp(i,j/2);
return mod(h*h);
}
return mod(i*upp(i,j-1));
}
vector<vector<ll> > CI(200001 , vector<ll>());
vector<ll> I;
ll A[200001][2];
ll deg[100001] = {0};
ll SP[200001][2] = {0};
ll ans = -1;
void dijk(){
priority_queue<ll> PQ;
bool mark[200001][2] = {0};
for(ll c1 = 0; c1 < deg[0]; c1++){
PQ.push(-(1 * 1000000000 + 2*CI[0][c1] + (0 == A[CI[0][c1]][1])));
}
while(!PQ.empty()){
ll a = -PQ.top();
PQ.pop();
ll w = a/1000000000;
ll b = a%1000000000;
bool t = b%2;
ll i = b/2;
if(mark[i][t] == 0){SP[i][t] = w;}
mark[i][t] = 1;
a = A[i][t^1];
if(a == n-1){
if(ans == -1){ans = w;}
ans = min(ans , w);
return;
}
ll c = I[i];
for(ll c1 = 0; c1 < deg[a]; c1++){
b = CI[a][c1];
bool t2 = (a == A[CI[a][c1]][1]);
ll nw = w + (c != I[b]);
if(mark[b][t2] == 0 && (SP[b][t2] == -1 || SP[b][t2] < nw)){
if(nw == w){
mark[b][t2] = 1;
}
PQ.push(-(nw * 1000000000 + 2*CI[a][c1] + t2));
}
}
}
}
int main()
{
ll c1,c2,c3,c4,c5,c6;
ll a,b,d,e,g;
ll x,y,z;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
scanf("%d %d" , &n &m);
for(c1 = 0; c1 < m; c1++){
SP[c1][0] = -1;
SP[c1][1] = -1;
scanf("%d %d % d" , &a &b , &d);
a--;
b--;
deg[a]++;
deg[b]++;
CI[a].push_back(c1);
CI[b].push_back(c1);
A[c1][0] = a;
A[c1][1] = b;
I.push_back(d);
}
dijk();
cout << ans << "\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:108:21: error: invalid operands of types 'll*' {aka 'long long int*'} and 'll' {aka 'long long int'} to binary 'operator&'
108 | scanf("%d %d" , &n &m);
| ~~ ^~
| | |
| | ll {aka long long int}
| ll* {aka long long int*}
a.cc:114:33: error: invalid operands of types 'll*' {aka 'long long int*'} and 'll' {aka 'long long int'} to binary 'operator&'
114 | scanf("%d %d % d" , &a &b , &d);
| ~~ ^~
| | |
| | ll {aka long long int}
| ll* {aka long long int*}
|
s590732453
|
p04001
|
C++
|
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_set>
#include<set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#define int int32_t
#define REP(i, a, b) for (int32_t i = (int32_t)(a); i < (int32_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
using namespace std;
signed main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
int N,M;
cin >> N >> M;
vector<vector<array<int, 2>>>subway(N);
rep(i, M) {
int p, q, c;
cin >> p >> q >> c;
p--; q--; c--;
subway[p].push_back({ q,c });
subway[q].push_back({ p,c });
}
//subway[i]:={町iから行ける駅、その鉄道会社}の集合
typedef array<int, 3> arr;//移動コスト、現在地、現在の鉄道会社
priority_queue<arr, vector<arr>, greater<arr>>D;
vector<unordered_set<int, int>>cost(N);
vector<int>min_cost(N, 99999999);
D.push({ 0,0,1111111 });
while (!D.empty()) {
const auto a = D.top(); D.pop();
const int now_cost = a[0];
const int pos = a[1];
const int kaisha = a[2];
if (min_cost[pos] + 1 <= now_cost)continue;
min_cost[pos] = min(min_cost[pos], now_cost);
if (pos == N - 1)break;
auto itr = cost[pos].find(kaisha);
if (itr != cost[pos].end())continue;
cost[pos].insert(kaisha);
rep(i, subway[pos].size()) {
auto next = subway[pos][i];
const int next_kaisha = next[1];
const int next_cost = now_cost + (next_kaisha == kaisha ? 0 : 1);
const int next_pos = next[0];
if (min_cost[next_pos] + 1 <= next_cost)continue;
auto nitr = cost[next_pos].find(next_kaisha);
if (nitr != cost[next_pos].end())continue;
D.push({ next_cost,next_pos,next_kaisha });
}
}
if (min_cost[N - 1] == 99999999)cout << -1 << endl;
else cout << min_cost[N - 1] << endl;
}
|
In file included from /usr/include/c++/14/bits/hashtable.h:35,
from /usr/include/c++/14/bits/unordered_set.h:33,
from /usr/include/c++/14/unordered_set:41,
from a.cc:4:
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::__hash_code std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_M_hash_code(const _Key&) const [with _Key = int; _Value = int; _ExtractKey = std::__detail::_Identity; _Hash = int; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true; __hash_code = long unsigned int]':
/usr/include/c++/14/bits/hashtable.h:1740:46: required from 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::iterator std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::find(const key_type&) [with _Key = int; _Value = int; _Alloc = std::allocator<int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<int>; _Hash = int; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>; iterator = std::__detail::_Insert_base<int, int, std::allocator<int>, std::__detail::_Identity, std::equal_to<int>, int, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::iterator; key_type = int]'
1740 | __hash_code __code = this->_M_hash_code(__k);
| ~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/unordered_set.h:658:25: required from 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>::iterator std::unordered_set<_Value, _Hash, _Pred, _Alloc>::find(const key_type&) [with _Value = int; _Hash = int; _Pred = std::equal_to<int>; _Alloc = std::allocator<int>; iterator = std::__detail::_Insert_base<int, int, std::allocator<int>, std::__detail::_Identity, std::equal_to<int>, int, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::iterator; key_type = int]'
658 | { return _M_h.find(__x); }
| ~~~~~~~~~^~~~~
a.cc:56:28: required from here
56 | auto itr = cost[pos].find(kaisha);
| ~~~~~~~~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1335:23: error: static assertion failed: hash function must be invocable with an argument of key type
1335 | static_assert(__is_invocable<const _Hash&, const _Key&>{},
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1335:23: note: 'std::__is_invocable<const int&, const int&>()' evaluates to false
/usr/include/c++/14/bits/hashtable_policy.h:1337:25: error: expression cannot be used as a function
1337 | return _M_hash()(__k);
| ~~~~~~~~~^~~~~
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::__hash_code std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_M_hash_code_tr(const _Kt&) const [with _Kt = int; _Key = int; _Value = int; _ExtractKey = std::__detail::_Identity; _Hash = int; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true; __hash_code = long unsigned int]':
/usr/include/c++/14/bits/hashtable.h:2329:44: required from 'std::pair<typename std::__detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::iterator, bool> std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_M_insert_unique(_Kt&&, _Arg&&, const _NodeGenerator&) [with _Kt = const int&; _Arg = const int&; _NodeGenerator = std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<int, true> > >; _Key = int; _Value = int; _Alloc = std::allocator<int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<int>; _Hash = int; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>; typename std::__detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::iterator = std::__detail::_Insert_base<int, int, std::allocator<int>, std::__detail::_Identity, std::equal_to<int>, int, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::iterator; typename _Traits::__constant_iterators = std::__detail::_Hashtable_traits<true, true, true>::__constant_iterators]'
2329 | __hash_code __code = this->_M_hash_code_tr(__k);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/hashtable.h:947:27: required from 'std::pair<typename std::__detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::iterator, bool> std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_M_insert_unique_aux(_Arg&&, const _NodeGenerator&) [with _Arg = const int&; _NodeGenerator = std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<int, true> > >; _Key = int; _Value = int; _Alloc = std::allocator<int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<int>; _Hash = int; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>; typename std::__detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::iterator = std::__detail::_Insert_base<int, int, std::allocator<int>, std::__detail::_Identity, std::equal_to<int>, int, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::iterator; typename _Traits::__constant_iterators = std::__detail::_Hashtable_traits<true, true, true>::__constant_iterators]'
947 | return _M_insert_unique(
| ~~~~~~~~~~~~~~~~^
948 | _S_forward_key(_ExtractKey{}(std::forward<_Arg>(__arg))),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
949 | std::forward<_Arg>(__arg), __node_gen);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:959:31: required from 'std::pair<typename std::__detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::iterator, bool> std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_M_insert(_Arg&&, const _NodeGenerator&, std::true_type) [with _Arg = const int&; _NodeGenerator = std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<int, true> > >; _Key = int; _Value = int; _Alloc = std::allocator<int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<int>; _Hash = int; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>; typename std::__detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::iterator = std::__detail::_Insert_base<int, int, std::allocator<int>, std::__detail::_Identity, std::equal_to<int>, int, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::iterator; typename _Traits::__constant_iterators = std::__detail::_Hashtable_traits<true, true, true>::__constant_iterators; std::true_type = std::true_type]'
959 | return _M_insert_unique_aux(
| ~~~~~~~~~~~~~~~~~~~~^
960 | __to_value{}(std::forward<_Arg>(__arg)), __node_gen);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:958:22: required from 'std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::__ireturn_type std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::insert(const value_type&) [with _Key = int; _Value = int; _Alloc = std::allocator<int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<int>; _Hash = int; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>; __ireturn_type = std::__detail::_Insert_base<int, int, std::allocator<int>, std::__detail::_Identity, std::equal_to<int>, int, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::__ireturn_type; value_type = int]'
958 | return __h._M_insert(__v, __node_gen, __unique_keys{});
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_set.h:429:27: required from 'std::pair<typename std::_Hashtable<_Value, _Value, _Alloc, std::__detail::_Identity, _Pred, _Hash, std::__detail::_Mod_range_hashing,
|
s234442167
|
p04001
|
C++
|
#include <bits/stdc++.h>
#define FOR(i,a,b) for(LL i=(a);i<(LL)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define FF first
#define SS second
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const ut INF=1LL<<30;
const int SIZE=5+1e5;
map<LL,LL> searched;
Vpr edge[SIZE];
VI miniumed[SIZE];
LL minium[SIZE];
LL p[SIZE],q[SIZE],c[SIZE];
int main(){
int N,M;
cin.tie(0);
cin >> N >> M;
FOR(i,1,N+1) minium[i]=INF;
REP(i,M){
cin >> p[i] >> q[i] >> c[i];
edge[p[i]].PB(pr(c[i],q[i]));
edge[q[i]].PB(pr(c[i],p[i]));
}
FOR(i,1,N+1){
sort(ALL(edge[i]));
edge[i].PB(INF);
}
PQ qu;
qu.push(pr(0,1));
while(!qu.empty()){
LL dist=qu.top().first,now=qu.top().second;
qu.pop();
if(searched[now]) continue;
searched[now]=true;
sort(ALL(miniumed[now]));
int ces=0;
REP(i,edge[now].size()){
int next=edge[now][i].second;
int nuse=edge[now][i].first;
while(miniumed[now][ces]<nuse) ces++;
LL ndist=dist+(nuse!=miniumed[now][ces]);
if(minium[next]>=ndist){
if(minium[next]>ndist)
miniumed[next].clear();
minium[next]=ndist;
miniumed[next].PB(nuse);
qu.push(pr(ndist,next));
}
}
}
if(minium[N]==INF) cout << -1 << endl;
else cout << minium[N] << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:38:27: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(const ut&)'
38 | edge[i].PB(INF);
| ~~~~~~~~~~^~~~~
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:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'const ut' {aka 'const long long int'} to 'const std::vector<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'const ut' {aka 'const long long int'} to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
|
s630101181
|
p04001
|
C++
|
#include <climits>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
using namespace std;
#define MODULE 1000000007
#define MP make_pair
template<class T, class U>
inline void chmin(T &t, U f) { if (t > f)t = f; }
template<class T, class U>
inline void chmax(T &t, U f) { if (t < f)t = f; }
typedef pair<int, int> P;
typedef long long LL;
const int INF = INT_MAX / 2; //int_max->2*e+9
const int MAXN = 1001;
//------繰り返し二乗法
LL fastPow(LL x,LL n){ // O(logN)
LL res=1;
while(n>0){
if(n&1)res=res*x;
x=x*x;
n>>=1;
}
return res;
}
LL res=0;
void sumVector(vector<iLL> &nums){
for (int i = 0; i < nums.size(); ++i) {
res+=nums.at(i);
}
}
string s;
void rec(int index,LL num, vector<LL> emittedNums){
if(index!=s.length()) {
rec(index + 1, num * 10 + s.at(index) - 48, emittedNums);
emittedNums.push_back(num);
rec(index + 1, s.at(index) - 48, emittedNums);
}else{
sumVector(emittedNums);
res+=num;
return;
}
}
int main() {
cin>>s;
vector<LL> v;
rec(0,0,v);
cout<<res/2<<endl;
return 0;
}
|
a.cc:39:23: error: 'iLL' was not declared in this scope; did you mean 'LL'?
39 | void sumVector(vector<iLL> &nums){
| ^~~
| LL
a.cc:39:26: error: template argument 1 is invalid
39 | void sumVector(vector<iLL> &nums){
| ^
a.cc:39:26: error: template argument 2 is invalid
a.cc: In function 'void sumVector(int&)':
a.cc:40:30: error: request for member 'size' in 'nums', which is of non-class type 'int'
40 | for (int i = 0; i < nums.size(); ++i) {
| ^~~~
a.cc:41:19: error: request for member 'at' in 'nums', which is of non-class type 'int'
41 | res+=nums.at(i);
| ^~
a.cc: In function 'void rec(int, LL, std::vector<long long int>)':
a.cc:53:19: error: invalid initialization of reference of type 'int&' from expression of type 'std::vector<long long int>'
53 | sumVector(emittedNums);
| ^~~~~~~~~~~
a.cc:39:29: note: in passing argument 1 of 'void sumVector(int&)'
39 | void sumVector(vector<iLL> &nums){
| ~~~~~~~~~~~~~^~~~
|
s936433065
|
p04001
|
C++
|
#include <climits>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
using namespace std;
#define MODULE 1000000007
#define MP make_pair
template<class T, class U>
inline void chmin(T &t, U f) { if (t > f)t = f; }
template<class T, class U>
inline void chmax(T &t, U f) { if (t < f)t = f; }
typedef pair<int, int> P;
typedef long long LL;
const int INF = INT_MAX / 2; //int_max->2*e+9
const int MAXN = 1001;
//------繰り返し二乗法
LL fastPow(LL x,LL n){ // O(logN)
LL res=1;
while(n>0){
if(n&1)res=res*x;
x=x*x;
n>>=1;
}
return res;
}
LL res=0;
void sumVector(vector<iLL> &nums){
for (int i = 0; i < nums.size(); ++i) {
res+=nums.at(i);
}
}
string s;
void rec(int index,LL num, vector<LL> emittedNums){
if(index!=s.length()) {
rec(index + 1, num * 10 + s.at(index) - 48, emittedNums);
emittedNums.push_back(num);
rec(index + 1, s.at(index) - 48, emittedNums);
}else{
sumVector(emittedNums);
res+=num;
return;
}
}
int main() {
cin>>s;
vector<LL> v;
rec(0,0,v);
cout<<res<<endl;
return 0;
}
|
a.cc:39:23: error: 'iLL' was not declared in this scope; did you mean 'LL'?
39 | void sumVector(vector<iLL> &nums){
| ^~~
| LL
a.cc:39:26: error: template argument 1 is invalid
39 | void sumVector(vector<iLL> &nums){
| ^
a.cc:39:26: error: template argument 2 is invalid
a.cc: In function 'void sumVector(int&)':
a.cc:40:30: error: request for member 'size' in 'nums', which is of non-class type 'int'
40 | for (int i = 0; i < nums.size(); ++i) {
| ^~~~
a.cc:41:19: error: request for member 'at' in 'nums', which is of non-class type 'int'
41 | res+=nums.at(i);
| ^~
a.cc: In function 'void rec(int, LL, std::vector<long long int>)':
a.cc:53:19: error: invalid initialization of reference of type 'int&' from expression of type 'std::vector<long long int>'
53 | sumVector(emittedNums);
| ^~~~~~~~~~~
a.cc:39:29: note: in passing argument 1 of 'void sumVector(int&)'
39 | void sumVector(vector<iLL> &nums){
| ~~~~~~~~~~~~~^~~~
|
s639701597
|
p04001
|
C++
|
#include<iostream>
#include<cmath>
#include<stack>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef unsigned long long ll;
ll stol(string s){
ll res=0;
rep(i,s.size()){
res+=(int)(s[i]-'0')*pow(10,s.size()-i-1);
}
return res;
}
ll cal(stack<char> ta){
ll res=0,size=ta.size();
char a;
rep(i,size){
a=ta.top();
ta.pop();
res+=(int)(a-'0')*pow(10,i);
}
return res;
}
int main(){
ll n;
string s;
cin>>s;
n=stol(s);
ll dp[(int)pow(2,s.size()-1)];
rep(i,(int)pow(2,s.size()-1))dp[i]=0;
rep(i,(int)pow(2,s.size()-1)){
stack<char> st;
rep(j,s.size()-1){
if((i & (1<<j))){
st.push(s[j]);
dp[i]+=cal(st);
while(!st.empty())st.pop();
}else{
st.push(s[j]);
}
}
st.push(s[s.size()-1]);
dp[i]+=cal(st);
}
ll res=0;
rep(i,(int)pow(2,s.size()-1))res+=dp[i];
cout<<res<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:32:15: error: call of overloaded 'stol(std::string&)' is ambiguous
32 | n=stol(s);
| ~~~~^~~
a.cc:9:4: note: candidate: 'll stol(std::string)'
9 | ll stol(string s){
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4169:3: note: candidate: 'long int std::__cxx11::stol(const std::string&, std::size_t*, int)'
4169 | stol(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
|
s650624158
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(int argc, char* argv[])
{
string S;
cin>>S;
long long sum=0;
int i=0;
int sLen = S.length();
char *pStr = (char*)S.c_str();
for (i=0;i<sLen;i++){
sum+=pStr[i]-'0';
}
sum+=_atoi64((char*)S.c_str());
long long x,y;
for (i=1;i<sLen;i++){
x=_atoi64(S.substr(0,i).c_str());
y=_atoi64(S.substr(i,sLen-i).c_str());
sum += x+y;
}
cout<<sum<<endl;
return 0;
}
|
a.cc: In function 'int main(int, char**)':
a.cc:18:14: error: '_atoi64' was not declared in this scope; did you mean 'atoi'?
18 | sum+=_atoi64((char*)S.c_str());
| ^~~~~~~
| atoi
|
s155797838
|
p04001
|
C++
|
#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<functional>
#include<algorithm>
#define ms0(a) memset(a,0,sizeof(a))
#define ms1(a) memset(a,-1,sizeof(a))
#define pb(a) push_back(a)
using namespace std;
typedef __int64 ll;
const double Eps = (double)0.5;
const int M = 1e9 + 7;
const int N = 1e3 + 5;
const double PI = acos(-1.0);
char aa[15];
int a[15];
ll c[15];
int l;
ll asr =0;
void dfs(int i, int j, int k)
{
if(l - 1 - i + j < k )
return ;
if(j == k)
{
for(int o = i; o < l; o++)
{
c[j-1] = c[j-1] * 10 + a[o];
}
for(int o = 0; o< j; o++)
{
asr += c[o];
//cout<<c[o] << " ";
}
// cout<<"\n---------\n";
return ;
}
c[j - 1] = 10 * c[j - 1] + a[i];
c[j] = 0;
dfs(i+1, j+1, k);
dfs(i+1, j, k);
}
/*void dfs(int i, int j)
{
c[j] = 10 * c[j] + a[i];
}*/
int main()
{
cin>>aa;
l = strlen(aa);
for(int i=0; i<l; i++)
a[i] = aa[i] - '0';
/* for(int i=0; i<l;i++)
{
asr = 10 * asr + a[i] ;
}*/
for(int i=0; i<l; i++)
{
c[0] = 0;
dfs(0, 1, i+1);
//dfs(0,0)
}
// cout <<asr <<endl;
printf("%I64d\n",asr);
return 0;
}
|
a.cc:17:9: error: '__int64' does not name a type; did you mean '__int64_t'?
17 | typedef __int64 ll;
| ^~~~~~~
| __int64_t
a.cc:25:1: error: 'll' does not name a type
25 | ll c[15];
| ^~
a.cc:27:1: error: 'll' does not name a type
27 | ll asr =0;
| ^~
a.cc: In function 'void dfs(int, int, int)':
a.cc:37:13: error: 'c' was not declared in this scope
37 | c[j-1] = c[j-1] * 10 + a[o];
| ^
a.cc:41:17: error: 'asr' was not declared in this scope
41 | asr += c[o];
| ^~~
a.cc:41:24: error: 'c' was not declared in this scope
41 | asr += c[o];
| ^
a.cc:48:5: error: 'c' was not declared in this scope
48 | c[j - 1] = 10 * c[j - 1] + a[i];
| ^
a.cc: In function 'int main()':
a.cc:71:9: error: 'c' was not declared in this scope
71 | c[0] = 0;
| ^
a.cc:76:21: error: 'asr' was not declared in this scope
76 | printf("%I64d\n",asr);
| ^~~
|
s524940699
|
p04001
|
C++
|
// Author : SAGORIKA DAS
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
#define int long long
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
string s;
int eval(int i, int j){
int ret = 0;
for(int k=i;k<=j;k++){
ret = ret*10 + (s[k]-'0');
}
return ret;
}
int _pow(int base, int e){
int ret = 1;
while(e){
if(e%2) ret= ret*base;
base = base*base;
e /= 2;
}
return ret;
}
main() {
//fr;fw;
cin >> s;
int zero = 0;
int ret = 0;
for(int i=0;i<s.size();i++){
for(int j=i;j<s.size();j++){
int val = eval(i,j);
ret += val*(_pow(2,max(i-1,zero)))*(_pow(2,max(zero,s.size()-2-j)));
}
}
cout << ret;
return 0;
}
|
a.cc:38:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
38 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:46:55: error: no matching function for call to 'max(long long int&, long long unsigned int)'
46 | ret += val*(_pow(2,max(i-1,zero)))*(_pow(2,max(zero,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~~
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:2:
/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:46:55: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
46 | ret += val*(_pow(2,max(i-1,zero)))*(_pow(2,max(zero,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~~
/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:46:55: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
46 | ret += val*(_pow(2,max(i-1,zero)))*(_pow(2,max(zero,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~~
|
s187565908
|
p04001
|
C++
|
// Author : SAGORIKA DAS
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
#define int long long
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
string s;
int eval(int i, int j){
int ret = 0;
for(int k=i;k<=j;k++){
ret = ret*10 + (s[k]-'0');
}
return ret;
}
main() {
// fr;fw;
cin >> s;
int zero = 0;
int ret = 0;
for(int i=0;i<s.size();i++){
for(int j=i;j<s.size();j++){
int val = eval(i,j);
ret += val*(pow(2,max(i-1,zero)))*(pow(2,max(zero,s.size()-2-j)));
}
}
cout << ret;
return 0;
}
|
a.cc:28:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
28 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:36:53: error: no matching function for call to 'max(long long int&, long long unsigned int)'
36 | ret += val*(pow(2,max(i-1,zero)))*(pow(2,max(zero,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~~
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:2:
/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:36:53: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
36 | ret += val*(pow(2,max(i-1,zero)))*(pow(2,max(zero,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~~
/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:36:53: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
36 | ret += val*(pow(2,max(i-1,zero)))*(pow(2,max(zero,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~~
|
s303916349
|
p04001
|
C++
|
// Author : SAGORIKA DAS
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
#define int long long
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
string s;
int eval(int i, int j){
int ret = 0;
for(int k=i;k<=j;k++){
ret = ret*10 + (s[k]-'0');
}
return ret;
}
main() {
//fr;fw;
cin >> s;
int ret = 0;
for(int i=0;i<s.size();i++){
for(int j=i;j<s.size();j++){
int val = eval(i,j);
ret += val*(pow(2,max(i-1,0LL)))*(pow(2,max(0LL,s.size()-2-j)));
}
}
cout << ret;
return 0;
}
|
a.cc:28:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
28 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:35:52: error: no matching function for call to 'max(long long int, long long unsigned int)'
35 | ret += val*(pow(2,max(i-1,0LL)))*(pow(2,max(0LL,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~
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:2:
/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:35:52: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
35 | ret += val*(pow(2,max(i-1,0LL)))*(pow(2,max(0LL,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~
/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:35:52: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
35 | ret += val*(pow(2,max(i-1,0LL)))*(pow(2,max(0LL,s.size()-2-j)));
| ~~~^~~~~~~~~~~~~~~~~~
|
s949626958
|
p04001
|
C++
|
#include<cstdio>
#include<cstring>
using namespace std;
const int MAX = 10 + 10;
char arr[MAX];
char tmp[MAX];
int main(){
gets(arr);
int len = strlen(arr);
long long ans = 0;
for(int i = 0 ; i < (1<<(len-1)) ; i++){
memset(tmp, 0, sizeof(tmp));
int now = 0;
for(int j = 0 ; j < len ; j++){
tmp[now++] = arr[j];
if (i&(1<<j)) {
tmp[now++] = ' ';
}
}
long long t;
int sum = 0, n = 0;
while(~sscanf(tmp+sum, "%lld%n", &t, &n)) {
ans += t;
sum += n;
}
}
printf("%lld\n", ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(arr);
| ^~~~
| getw
|
s623471779
|
p04001
|
C++
|
#include <map>
#include <functional>
#include <iterator>
#include <vector>
#include <cstdio>
#include <array>
namespace XX
{
template<template<typename> class Compare, typename T>
inline T& UP(T& x, const T& y){if(Compare<T>()(y, x)) x = y; return x;}
template<typename Compare, typename T>
inline T& UP(T& x, const T& y, Compare comp){if(comp(y, x)) x = y; return x;}
template<typename T> inline T& GT(T& x, const T& y){return UP<std::greater>(x, y);}
template<typename T> inline T& LS(T& x, const T& y){return UP<std::less>(x, y);}
template<typename T>
struct Mapper
{
int operator[](const T& v) { int& ret = table[v]; if(!ret) rtable[ret = table.size()] = v; return ret - 1; }
template<typename... Args> int operator()(Args... args) { return (*this)[T(args...)]; }
T rev(int idx){return rtable[idx + 1];}
std::map<T, int> table;
std::map<int, T> rtable;
};
template<typename T, int S>
struct ReferenceArray
{
struct It {typename std::array<T*, S>::iterator it; T& operator*(){return **it;} void operator++(){it++;} bool operator!=(const It& other){return it != other.it;} };
int size()const{return _ptr.size();}
It begin()const{return {_ptr.begin()};}
It end()const{return {_ptr.end()};}
T& operator[](int idx)const{return *_ptr[idx];}
mutable std::array<T*, S> _ptr;
};
template<typename T, typename... Args>
ReferenceArray<T, sizeof...(Args) + 1> MAKEV(T& arg1, Args&... args) {return {&arg1, &args...};}
struct Range
{
struct It { int num, step; int operator*(){return num;} void operator++(){num += step;} bool operator!=(const It& other){return num != other.num;} };
Range(int ee):b(0),e(ee){}
Range(int bb, int ee):b(bb), e(ee){}
It begin(){return {b, (b < e? 1: -1)};}
It end(){return {e, 0};}
int b, e;
};
}
template<typename T> struct ScanfSpecifier{};
#define DEF(T,V) template<> struct ScanfSpecifier<T>{static constexpr const char* value = V;};
DEF(int,"%d")DEF(double,"%lf")DEF(float,"%f")DEF(char,"%c")DEF(const char*,"%s")DEF(unsigned long,"%lu")DEF(unsigned int, "%u")
#ifdef _MSC_VER
DEF(long long int,"%I64d")
#else
DEF(long long int,"%lld")
#endif
#undef DEF
template<typename T> int RD(T& arg){return std::scanf(ScanfSpecifier<T>::value, &arg);}
template<int S> int RD(char (&arg)[S]){return std::scanf("%s", arg);}
int RD(char* arg){return std::scanf("%s", arg);}
template<> int RD<char>(char& arg){return std::scanf(" %c", &arg);}
template<typename T, typename... Args> int RD(T& arg1, Args&... args) {return RD(arg1) + RD(args...);}
template<typename T> T RD(){T ret; RD(ret); return ret;}
template<typename It> void RDV(It begin, It end) { while(begin != end) RD(*begin++); }
template<typename C> void RDV(C& c) {RDV(std::begin(c), std::end(c));}
template<typename... Args> void WT(Args... args) { int alc = 0; int dummy[] = {((alc++? std::printf(" "): 0), std::printf(ScanfSpecifier<Args>::value, args), 0)...}; }
template<typename... Args> void WTL(Args... args) { WT(args...); std::printf("\n"); }
template<typename It> void WTV(It begin, It end) { int alc = 0; while(begin != end) (alc++? std::printf(" "): 0), WT(*begin++); }
template<typename C> void WTV(const C& c) {WTV(std::begin(c), std::end(c));}
template<typename It> void WTVL(It begin, It end) { WTV(begin, end); std::printf("\n"); }
template<typename C> void WTVL(const C& c) {WTVL(std::begin(c), std::end(c));}
//alias
template<typename T> T& UMAX(T& x, T y){return XX::UP<std::greater>(x, y);}
template<typename T> T& UMIN(T& x, T y){return XX::UP<std::less>(x, y);}
using XX::UP; //(x,y) comp
using RG = XX::Range;
using XX::MAKEV;
using XX::Mapper;
//RD[L],RDV[L],WT[L],WTV[L] for i/o
//template
#include <vector>
#include <string>
#include <set>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <functional>
using namespace std;
char buf[123];
int main()
{
RD(buf);
int N = strlen(buf);
long long int ans = 0;
for(int i = 0; buf[i]; i++)
{
long long int v = 0;
for(int j = i; buf[j]; j++)
{
v = v * 10 + buf[j] - '0';
ans += v * (1ll << max(0, i - 1)) * (1ll << max(0, N - 1 - j - 1));
}
}
WTL(ans);
}
|
a.cc: In function 'int main()':
a.cc:106:13: error: 'strlen' was not declared in this scope
106 | int N = strlen(buf);
| ^~~~~~
a.cc:97:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
96 | #include <algorithm>
+++ |+#include <cstring>
97 | #include <functional>
|
s233832427
|
p04001
|
C++
|
#include<iostream>
using namespace std;
char s[111];
int n;
long long tot;
void dfs(int dep, long long sum, long long cur) {
if(dep==n) {
tot += sum + cur;
return;
}
if(cur) dfs(dep+1, sum + cur, s[dep] - '0');
dfs(dep+1, sum, cur*10+s[dep]-'0');
}
int main() {
cin>>s;
n = strlen(s);
tot = 0LL;
dfs(0, 0LL, 0LL);
cout<<tot<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:13: error: 'strlen' was not declared in this scope
19 | n = strlen(s);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s833209471
|
p04001
|
C++
|
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
final Scanner sc = new Scanner(System.in);
final char[] input = sc.next().toCharArray();
final int limit = input.length - 1;
long answer = 0;
for(int bit = 0; bit < (1 << limit); bit++){
StringBuilder sb = new StringBuilder();
long sum = 0;
for(int pos = 0; pos < input.length; pos++){
sb.append(input[pos]);
if((bit & (1 << pos)) != 0){
sum += Long.parseLong(sb.toString());
sb.setLength(0);
}
}
if(sb.length() != 0){
sum += Long.parseLong(sb.toString());
}
answer += sum;
}
System.out.println(answer);
}
public static class Scanner implements Closeable {
private BufferedReader br;
private StringTokenizer tok;
public Scanner(InputStream is) throws IOException {
br = new BufferedReader(new InputStreamReader(is));
}
private void getLine() throws IOException {
while (!hasNext()) {
tok = new StringTokenizer(br.readLine());
}
}
private boolean hasNext() {
return tok != null && tok.hasMoreTokens();
}
public String next() throws IOException {
getLine();
return tok.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public double nextDouble() throws IOException {
return Double.parseDouble(next());
}
public void close() throws IOException {
br.close();
}
}
}
|
a.cc:1:1: error: 'import' does not name a type
1 | import java.io.BufferedReader;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.Closeable;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.io.IOException;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.io.InputStream;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.io.InputStreamReader;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.io.PrintWriter;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.math.BigDecimal;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import java.math.BigInteger;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
9 | import java.util.ArrayList;
| ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
10 | import java.util.Arrays;
| ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:1: error: 'import' does not name a type
11 | import java.util.Collections;
| ^~~~~~
a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:12:1: error: 'import' does not name a type
12 | import java.util.HashMap;
| ^~~~~~
a.cc:12:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:13:1: error: 'import' does not name a type
13 | import java.util.HashSet;
| ^~~~~~
a.cc:13:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:14:1: error: 'import' does not name a type
14 | import java.util.LinkedList;
| ^~~~~~
a.cc:14:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:15:1: error: 'import' does not name a type
15 | import java.util.PriorityQueue;
| ^~~~~~
a.cc:15:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:16:1: error: 'import' does not name a type
16 | import java.util.StringTokenizer;
| ^~~~~~
a.cc:16:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:18:1: error: expected unqualified-id before 'public'
18 | public class Main {
| ^~~~~~
|
s668971791
|
p04002
|
C++
|
/*-- ILSH --*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
#define pb push_back
#define pop pop_back
#define mp make_pair
#define vii vector < ll >
#define pii pair< ll, ll >
#define len length
#define fi first
#define se second
#define dt cout<<"HEre\n";
#define sz(x) (ll)x.size()
const ll inf=1e18+1e17;
const ll mod = 1e9+7;
ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}
const ll N=2e5+5;
void solve(){
map<pair< ll, ll > ,ll > m;
ll h,w,n;
cin>>h>> w>>n;
for ( ll i=0;i<n;i++){
ll a, b;
cin>>a>>b;
for ( ll i=max(1,a-2);i<=min(h-2,a);i++){
for ( ll j=max(1,b-2);j<=min(w-2,b);j++){
m[mp(i,j)]++;
}
}
}
ll cnt=0,ans[10]={0};
for ( auto i:m ){
cnt++;
ans[i.se]++;
}
ans[0]=(h-2)*(w-2)-cnt;
for ( ll i=0;i<10;i++)
cout<<ans[i]<<'\n';
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie( NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen ("INPUT.txt" , "r" , stdin);
freopen ("OUTPUT.txt", "w" , stdout);
#endif
ll t=1;
// cin>>t;
for ( ll i=1;i<=t;i++){
//cout<<"Case #"<<i<<": ";
solve();
}
// cout << clock() / double(CLOCKS_PER_SEC) << endl;
}
|
a.cc: In function 'void solve()':
a.cc:32:31: error: no matching function for call to 'max(int, ll)'
32 | for ( ll i=max(1,a-2);i<=min(h-2,a);i++){
| ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/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:32:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
32 | for ( ll i=max(1,a-2);i<=min(h-2,a);i++){
| ~~~^~~~~~~
/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:32:31: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
32 | for ( ll i=max(1,a-2);i<=min(h-2,a);i++){
| ~~~^~~~~~~
a.cc:33:39: error: no matching function for call to 'max(int, ll)'
33 | for ( ll j=max(1,b-2);j<=min(w-2,b);j++){
| ~~~^~~~~~~
/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:33:39: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
33 | for ( ll j=max(1,b-2);j<=min(w-2,b);j++){
| ~~~^~~~~~~
/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
/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:33:39: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
33 | for ( ll j=max(1,b-2);j<=min(w-2,b);j++){
| ~~~^~~~~~~
|
s883801970
|
p04002
|
C++
|
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
ll inf = (ll)1e9 + 7;
ll a[900009];
ll sum[20];
int dx[] = { 0,-1,-2,0,-1,-2,0,-1,-2 };
int dy[] = { 0,0,0,-1,-1,-1,-2,-2,-2 };
int main()
{
ll h, m, n;
scanf_s("%lld%lld%lld", &h, &m, &n);
ll x, y;
int k = 0;
ll zo = (h - 2) * (m - 2);
for (ll i = 1; i <= n; i++) {
scanf_s("%lld%lld", &x, &y);
for (ll j = 0; j < 9; j++) {
ll xn = x + dx[j], yn = y + dy[j];
if (xn<1 || xn>h - 2 || yn < 1 || yn>m - 2)continue;
a[k++] = inf * xn + yn;
}
}
sort(a, a + k);
ll t = 1;
for (int i = 0; i < k; i++) {
if (a[i] == a[i + 1])t++;
else {
sum[t]++; t = 1;
zo--;
}
}
printf("%lld\n", zo);
for (int i = 1; i <= 9; i++)
printf("%lld\n", sum[i]);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
15 | scanf_s("%lld%lld%lld", &h, &m, &n);
| ^~~~~~~
| scanf
|
s036090001
|
p04002
|
C++
|
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
inline char getcha() {
if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
return *ci++;
}
inline int getint() {
int A = 0;
if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
return A;
}
const int N=1e6+10;
ll a[N];
int sum[11];
main(){
ios
int h,w,n;
h=getint();w=getint();n=getint();
if(w==1000000000 && h==1000000000){
h-=2,w-=2;
int x,y;
int cnt=0;
ll m=(ll)h*w;
rep(iii,n){
x=getint();y=getint();
rep(i,3)if(x-i>=1 && x-i<=h){
rep(j,3)if(y-j<=w){
a[cnt++]=((ll)(x-i)<<32)+(y-j);
}
}
}
sort(a,a+cnt);
ll t=1;
rep(i,cnt){
if(a[i]==a[i+1])t++;
else sum[t]++,t=1,m--;
}
cout<<m<<" ";
rep2(i,1,9)cout<<sum[i]<<" ";
}
else{
h-=2,w-=2;
int x,y;
int cnt=0;
ll m=(ll)h*w;
rep(iii,n){
cin>>x>>y;
rep(i,3)if( x-i>=1 && x-i<=h){
rep(j,3)if(y-j>=1 && y-j<=w){
a[cnt++]=((ll)(x-i)<<32)+(y-j);
}
}
}
sort(a,a+cnt);
ll t=1;
rep(i,cnt){
if(a[i]==a[i+1])t++;
else sum[t]++,t=1,m--;
}
cout<<m<<" ";
rep2(i,1,9)cout<<sum[i]<<" ";
}
}
|
a.cc: In function 'char getcha()':
a.cc:9:13: error: 'ci' was not declared in this scope
9 | if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
| ^~
a.cc:9:18: error: 'cn' was not declared in this scope; did you mean 'yn'?
9 | if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
| ^~
| yn
a.cc:9:24: error: 'cm' was not declared in this scope; did you mean 'tm'?
9 | if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
| ^~
| tm
a.cc:10:17: error: 'ci' was not declared in this scope
10 | return *ci++;
| ^~
a.cc: In function 'int getint()':
a.cc:14:13: error: 'ci' was not declared in this scope
14 | if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
| ^~
a.cc:14:18: error: 'cn' was not declared in this scope; did you mean 'yn'?
14 | if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
| ^~
| yn
a.cc:14:28: error: 'cm' was not declared in this scope; did you mean 'tm'?
14 | if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
| ^~
| tm
a.cc:14:40: error: 'ct' was not declared in this scope
14 | if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
| ^~
a.cc:15:22: error: 'ct' was not declared in this scope
15 | else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
| ^~
a.cc: At global scope:
a.cc:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
21 | main(){
| ^~~~
|
s118518653
|
p04002
|
C++
|
#include<bits/stdc++.h>
using namespace std;
long long int h,w;
int n;
map<pair<int,int>,int> ma;
long long int ans[10];
int main(){
cin >> h >> w >> d;
for(int i=1;i<=n;i++){
int a,b;
cin >> a >> b;
for(int j=-1;j<=1;j++){
for(int k=-1;k<=1;k++){
int nx = a+j;
int ny = b+k;
if(nx < 2 || nx > h-1 || ny < 2 || ny > w-1) continue;
ma[make_pair(nx,ny)]++;
}
}
}
long long int res = (h-2)*(w-2);
for(auto x : ma ){
res--;
ans[x.second]++;
}
ans[0] = res;
for(int i=0;i<=9;i++){
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:13:26: error: 'd' was not declared in this scope
13 | cin >> h >> w >> d;
| ^
a.cc:37:25: error: 'a' was not declared in this scope
37 | cout << a[i] << endl;
| ^
|
s322144445
|
p04002
|
C++
|
#include<map>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define ll long long
#define REP(i,e,s) for(register ll i=e; i<=s; i++)
#define DREP(i,e,s) for(register ll i=e; i>=s; i--)
#define DE(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG(a) DE("DEBUG: %d\n",a)
#define int ll
int read() {
int x=0,f=1,ch=getchar();
while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
const int MAXN=100000+10;
struct edge {
int x,y;
} a[MAXN];
int ans[10];
map<pair<int,int>,int> mp;
signed main() {
int h=read(),w=read(),n=read();
REP(i,1,n) {
int x=read(),y=read();
REP(i,max(1ll,x-2),min(h-2,x)) REP(j,max(1ll,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
}
map<pair<int,int>,int>:: iterator iter;
iter=mp.begin();
while(iter!=mp.end()) {
ans[iter->second]++;
iter++;
}
int ans0=(h-2)*(w-2);
REP(i,1,9) ans0-=ans[i];
printf("%lld\n",ans0);
REP(i,1,9) printf("%lld\n",ans[i]);
return 0;
}
|
a.cc:27:13: error: extended character
is not valid in an identifier
27 | int ans[10];
| ^
a.cc:27:13: error: '\U00002028' does not name a type
27 | int ans[10];
| ^
a.cc: In function 'int main()':
a.cc:34:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
34 | REP(i,1,n) {
| ^
a.cc:8:36: note: in definition of macro 'REP'
8 | #define REP(i,e,s) for(register ll i=e; i<=s; i++)
| ^
a.cc:36:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
36 | REP(i,max(1ll,x-2),min(h-2,x)) REP(j,max(1ll,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
| ^
a.cc:8:36: note: in definition of macro 'REP'
8 | #define REP(i,e,s) for(register ll i=e; i<=s; i++)
| ^
a.cc:36:52: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
36 | REP(i,max(1ll,x-2),min(h-2,x)) REP(j,max(1ll,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
| ^
a.cc:8:36: note: in definition of macro 'REP'
8 | #define REP(i,e,s) for(register ll i=e; i<=s; i++)
| ^
a.cc:36:79: error: 'mp' was not declared in this scope
36 | REP(i,max(1ll,x-2),min(h-2,x)) REP(j,max(1ll,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
| ^~
a.cc:40:14: error: 'mp' was not declared in this scope
40 | iter=mp.begin();
| ^~
a.cc:48:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
48 | REP(i,1,9) ans0-=ans[i];
| ^
a.cc:8:36: note: in definition of macro 'REP'
8 | #define REP(i,e,s) for(register ll i=e; i<=s; i++)
| ^
a.cc:51:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
51 | REP(i,1,9) printf("%lld\n",ans[i]);
| ^
a.cc:8:36: note: in definition of macro 'REP'
8 | #define REP(i,e,s) for(register ll i=e; i<=s; i++)
| ^
|
s444638244
|
p04002
|
C++
|
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
#include <algorithm>
#include<set>
#include<map>
#include <limits>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_2 100000
#define d9_7 1000000007
int main(void){
ll h,w,n;
cin >> h>>w>>n;
vector<ll> a(n);
vector<ll> b(n);
rep(i,n){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
a[i]--;b[i]--;
}
map<pair<ll,ll>,int> mat;
ll cnt=0;
rep(i,n){
for(ll k1=-1;k1<=1;k1++){
for(ll k2=-1;k2<=1;k2++){
if(mat.find({k1+a[i],k2+b[i]})==mat.end()){
mat.insert({{k1+a[i],k2+b[i]},1});
}else{
mat[{k1+a[i],k2+b[i]}]++;
}
}
}
}
vector<ll> result(10,0);
for(auto i = mat.begin(); i != mat.end() ; ++i){
if(i->first.first<=h-3 && i->first.first>=0 &&i->first.second<=w--3&&i->first.second>=0){
cnt++;
result[i->second]++;
}
}
result[0]=(h-2)*(w-2)-cnt;
rep(i,10){
cout<<result[i]<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:47:71: error: expected ')' before numeric constant
47 | if(i->first.first<=h-3 && i->first.first>=0 &&i->first.second<=w--3&&i->first.second>=0){
| ~ ^
| )
|
s780617323
|
p04002
|
C++
|
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
#include <algorithm>
#include<set>
#include<map>
#include <limits>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_2 100000
#define d9_7 1000000007
int main(void){
ll h,w,n;
cin >> h>>w>>n;
vector<ll> a(n);
vector<ll> b(n);
rep(i,n){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
a[i]--;b[i]--;
}
map<pair<ll,ll>,int> mat;
ll cnt=0;
rep(i,n){
for(ll k1=-1;k1<=1;k1++){
for(ll k2=-1;k2<=1;k2++){
if(mat.find({k1+a[i],k2+b[i]})==mat.end()){
mat.insert({{k1+a[i],k2+b[i]},1});
}else{
mat[{k1+a[i],k2+b[i]}]++;
}
}
}
}
vector<ll> result(10,0);
for(auto i = mat.begin(); i != mat.end() ; ++i){
if(i->first.first<=h-3 && i->first.first>=0 &&i->first.second<=w--3&&i->first.second>=0){
cnt++;
result[i->second]++;
}
}
result[0]=(h-2)*(w-2)-cnt;
rep(i,10){
cout<<result[i]<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:47:71: error: expected ')' before numeric constant
47 | if(i->first.first<=h-3 && i->first.first>=0 &&i->first.second<=w--3&&i->first.second>=0){
| ~ ^
| )
|
s020951069
|
p04002
|
C++
|
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
#include <algorithm>
#include<set>
#include<map>
#include <limits>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_2 100000
#define d9_7 1000000007
int main(void){
ll h,w,n;
cin >> h>>w>>n;
vector<ll> a(n);
vector<ll> b(n);
vector<vector<bool>> mat(h,vector<bool>(w,false));
rep(i,n){
cin>>a[i]>>b[i];
mar[a[i]-1][b[i]-1]=true;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:30:5: error: 'mar' was not declared in this scope; did you mean 'mat'?
30 | mar[a[i]-1][b[i]-1]=true;
| ^~~
| mat
|
s415033230
|
p04002
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
signed main(){
int h,w,n; cin >> h >> w >> n;
set<pair<int,int>> st,table;
for(int i = 0; i < n; i++){
int a,b; cin >> a >> b;
a--,b--;
st.insert({a,b});
for(int dy : {-1,0,1}){
for(int dx : {-1,0,1}){
int ny = a + dy;
int nx = b + dx;
if(ny-1 < 0 || h <= ny+1 || nx-1 < 0 || w <= nx+1) continue;
table.insert({ny,nx});
}
}
}
vector<int> ans(10,0);
int ok = 0;
for(auto p : table){
int cnt = 0;
for(int dy : {-1,0,1}){
for(int dx : {-1,0,1}){
int ny = p.first + dy;
int nx = p.second + dx;
auto res = lower_bound(st.begin(),st.end(),make_pair(ny,nx));
if(res != st.end() && *res.first == ny && *res.second == nx) cnt++;
}
}
//cout << p << " " << cnt << endl;
ans[cnt]++;
ok++;
}
int ok_max = (h-2) * (w-2);
ans[0] += ok_max - ok;
for(int p : ans){
cout << p << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:36:36: error: 'struct std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' has no member named 'first'
36 | if(res != st.end() && *res.first == ny && *res.second == nx) cnt++;
| ^~~~~
a.cc:36:56: error: 'struct std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' has no member named 'second'
36 | if(res != st.end() && *res.first == ny && *res.second == nx) cnt++;
| ^~~~~~
|
s184352491
|
p04002
|
Java
|
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long h = sc.nextLong();
long w = sc.nextLong();
int n = sc.nextInt();
Map<Long, Map<Long, Integer>> row = new HashMap<Long, Map<Long, Integer>>();
for (int i = 0; i < n; i++) {
long a = sc.nextLong() - 1;
long b = sc.nextLong() - 1;
for (int j = 0; j < 3; j++) {
if (a - j < 0) break;
else if (a - j > h - 3) continue;
for (int k = 0; k < 3; k++) {
if (b - k < 0) break;
else if (b - k > w - 3) continue;
else {
if (row.containsKey(a - j)) {
if (row.get(a - j).containsKey(b - k)) {
row.get(a - j).put(b - k, row.get(a - j).get(b - k) + 1);
} else {
row.get(a - j).put(b - k, 1);
}
} else {
Map<Long, Integer> column = new HashMap<Long, Integer>();
column.put(b - k, 1);
row.put(a - j, column);
}
}
}
}
}
sc.close();
long count[] = new long[10];
for (int i = 0; i < 10; i++) {
count[i] = 0;
}
count[0] = (h - 2) * (w - 2);
for (Map<Long, Integer> map: row.values()) {
for (int val: map.values()) {
count[val]++;
count[0]--;
}
for (int i = 0; i < 10; i++) {
System.out.println(count[i]);
}
}
}
|
Main.java:57: error: reached end of file while parsing
}
^
1 error
|
s555605834
|
p04002
|
C++
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
ll H, W, N;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
ll ans[11];
int main()
{
cin >> H >> W >> N;
set<pair<ll, ll>> st, br;
ans[0] = (H - 2) * (W - 2);
for (int i = 0; i < N; i++)
{
ll y, x;
cin >> y >> x;
y--, x--;
pair<ll, ll> p = make_pair(y, x);
br.insert(p);
st.insert(p);
for (ll i = 0; i < 8; i++)
{
ll ny = y + dy[i], nx = x + dx[i];
if (ny < 0 || ny >= H)
continue;
if (nx < 0 || nx >= W)
continue;
pair<ll, ll> q = make_pair(ny, nx);
st.insert(q);
}
}
for (auto &p : st)
{
ll y = p.first, x = p.second, cnt = 0;
if (br.find(p) != br.end())
cnt++;
for (ll i = 0; i < 8; i++)
{
ll ny = y + dy[i], nx = x + dx[i];
if (ny < 0 || ny >= H || nx < 0 || nx >= W)
{
cnt = -1;
break;
}
pair<ll, ll> q = make_pair(ny, nx);
if (br.find(q) != br.end())
cnt++;
}
if (cnt != -1)
ans[cnt]++, ans[0]--;
}
for (int i = 0; i < 1-; i++)
cout << ans[i] << endl;
}
|
a.cc: In function 'int main()':
a.cc:57:27: error: expected primary-expression before ';' token
57 | for (int i = 0; i < 1-; i++)
| ^
|
s801369360
|
p04002
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int h,w,n;cin>>h>>w>>n;
map<pair<int,int>,int>cnt;
for(int i=0;i<n;i++){
int x,y;
cin >>x>>y;
for(int j=-2;j<=2;j++){
for(int k=-2;k<=2;k++){
int x0,y0;
x0=x+j;y0=y+k;
if(1ll<=x0 && x0<=h && 1ll<=y0 && y0<=w)
{pair<int,int> z=make_pair(x0,y0);
cnt[z]++;}
}
}
}
vector<int>ans(10,0);
for(int i=1;i<=9;i++){
ans[i]=count(begin(cnt),end(cnt),i);
}
int tmp=accumulate(begin(ans),end(ans),0ll);
ans[0]=h*w-tmp;
for(auto&& w:ans)cout<<w<<endl;
}
|
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_equals_val<_Value>::operator()(_Iterator) [with _Iterator = std::_Rb_tree_iterator<std::pair<const std::pair<long long int, long long int>, long long int> >; _Value = const long long int]':
/usr/include/c++/14/bits/stl_algobase.h:2163:12: required from 'typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::__count_if(_InputIterator, _InputIterator, _Predicate) [with _InputIterator = _Rb_tree_iterator<pair<const pair<long long int, long long int>, long long int> >; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<const long long int>; typename iterator_traits< <template-parameter-1-1> >::difference_type = long int]'
2163 | if (__pred(__first))
| ~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4033:29: required from 'typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&) [with _IIter = _Rb_tree_iterator<pair<const pair<long long int, long long int>, long long int> >; _Tp = long long int; typename iterator_traits< <template-parameter-1-1> >::difference_type = long int]'
4033 | return std::__count_if(__first, __last,
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
4034 | __gnu_cxx::__ops::__iter_equals_val(__value));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:15: required from here
24 | ans[i]=count(begin(cnt),end(cnt),i);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:270:24: error: no match for 'operator==' (operand types are 'std::pair<const std::pair<long long int, long long int>, long long int>' and 'const long long int')
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1208:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator==(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1208 | operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1208:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: 'std::pair<const std::pair<long long int, long long int>, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1216:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator==(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1216 | operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1216:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: 'std::pair<const std::pair<long long int, long long int>, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h: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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: 'std::pair<const std::pair<long long int, long long int>, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: 'std::pair<const std::pair<long long int, long long int>, long long int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: 'std::pair<const std::pair<long long int, long long int>, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const long long int'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: 'std::pair<const std::pair<long long int, long long int>, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const long long int'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: 'std::pair<const std::pair<long long int, long long int>, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: 'std::pair<const std::pair<long long int, long long int>, long long int>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/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:
/usr/include/c++/14/bits/predefined_ops.h:270:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'const long long int'
270 | { return *__it == _M_value; }
| ~~~~~~^~~~~~~~~~~
/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 fail
|
s245585365
|
p04002
|
C++
|
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End
using namespace std;
/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End
/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End
#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a) \
int a; \
cin >> a;
#define Cinii(a, b) \
int a, b; \
cin >> a >> b;
#define Ciniii(a, b, c) \
int a, b, c; \
cin >> a >> b >> c;
#define Cins(s) \
string s; \
cin >> s;
#define Cinss(s1, s2) \
string s1, s2; \
cin >> s1 >> s2;
#define Cinc(c) \
char c; \
cin >> c;
/// Functions End
/// Graph Start
struct edge {
int from, to;
long long cost;
};
/// Graph End
/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z) \
cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " \
<< z << endl;
/// Debug End
// int dx[] = {-1, 0, 1, 0};
// int dy[] = {0, -1, 0, 1};
int dx[] = {-1, 0, 1};
int dy[] = {-1, 0, 1};
/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/
/// template
#define int long long
signed main(void) {
cin.sync_with_stdio(false);
cin.tie(0);
Ciniii(H, W, N);
unordered_map<int, unordered_map<int, int> > m;
vector<int> ans(10);
int a[N], b[N]; // hoge
rep(i, N) {
int a, b;
cin >> a[i] >> b[i]; // hoge
}
for (int i = 0; i < N; i++) { // hoge
int y = a[i]; // hoge
int x = b[i]; // hoge
rep(ii, 3) rep(jj, 3) {
int yy = y + dy[ii];
int xx = x + dx[jj];
if(2<=yy&&yy<=H-1&&2<=xx&&xx<=W-1&&m[yy][xx]<=1){
rep(k, 3) rep(l, 3) {
int ny = yy + dy[k];
int nx = xx + dx[l];
}
m[yy][xx]+=100000000000;
}
}
}
for (auto i : m) {
for (auto j : i.second) {
if(j.second>=100000000000){
int y = i.first;
int x = j.first;
int count = 0;
rep(k, 3) rep(l, 3) { count += (m[y + dy[k]][x + dx[l]])%100000000000; }
ans[count]++;
}
}
}
int res = 0;
rep(i, 9) { res += ans[i + 1]; }
ans[0] = (H - 2) * (W - 2) - res;
rep(i, 10) { cout << ans[i] << nn; }
return 0;
}
|
a.cc: In function 'int main()':
a.cc:110:17: error: invalid types 'long long int[long long int]' for array subscript
110 | cin >> a[i] >> b[i]; // hoge
| ^
a.cc:110:25: error: invalid types 'long long int[long long int]' for array subscript
110 | cin >> a[i] >> b[i]; // hoge
| ^
|
s336952157
|
p04002
|
C++
|
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int h,w,n;cin>>h>>w>>n;
int cnt[100]={};
vector<pair<int,int> >bl(n);
map<pair<int,int>,int>MP2;
for(int i=0;i<n;i++){
cin>>bl[i].F>>bl[i].S;
MP2[mp(bl[i].F,bl[i].S)]=1;
}
sort(ALL(bl));
map<pair<int,int>,int >MP;
for(int i=0;i<n;i++){
int jl=max(1,bl[i].F-2),jr=min(bl[i].F,h-2);
int kl=max(1,bl[i].S-2),kr=min(bl[i].S,w-2);
for(int j=jl;j<=jr;j++){
for(int k=kl;k<=kr;k++){
if(MP[mp(j,k)]==0){
MP[mp(j,k)]=1;
int cntt=0;
for(int l=j;l<=j+2;l++)
for(int ll=k;ll<=k+2;ll++)
cntt+=MP2[mp(l,ll)];
cnt[cntt]++;
}
}
}
}
int sum=0;
for(int i=1;i<=9;i++)sum+=cnt[i];
cout<<(ll)(h-2)*(w-2)-sum<<endl;
for(int i=1;i<=9;i++)cout<<cnt[i]<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:45:23: error: expected unqualified-id before '=' token
45 | for(int ll=k;ll<=k+2;ll++)
| ^
a.cc:45:23: error: expected ';' before '=' token
a.cc:45:23: error: expected primary-expression before '=' token
a.cc:10:12: error: expected primary-expression before 'long'
10 | #define ll long long
| ^~~~
a.cc:45:26: note: in expansion of macro 'll'
45 | for(int ll=k;ll<=k+2;ll++)
| ^~
a.cc:45:26: error: expected ')' before 'long'
45 | for(int ll=k;ll<=k+2;ll++)
| ~ ^
| )
a.cc:45:28: error: expected unqualified-id before '<=' token
45 | for(int ll=k;ll<=k+2;ll++)
| ^~
a.cc:45:36: error: expected unqualified-id before '++' token
45 | for(int ll=k;ll<=k+2;ll++)
| ^~
|
s696977022
|
p04002
|
C++
|
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int h,w,n;cin>>h>>w>>n;
int cnt[100]={};
vector<pair<int,int> >bl(n);
for(int i=0;i<n;i++)cin>>bl[i].F>>bl[i].S;
sort(ALL(bl));
map<pair<int,int>,int >MP;
for(int i=0;i<n;i++){
for(int j=max(1,bl[i].F-2);j<=min(bl[i].F,h-2);j++){
for(int k=max(1LL,bl[i].S-2);k<=min(bl[i].S,w-2);k++){
if(MP[mp(j,k)]==0){
MP[mp(j,k)]=1;
auto lb=lower_bound(ALL(bl),mp(bl[i].F-2,-1));
auto ub=upper_bound(ALL(bl),mp(bl[i].F+2,INF));
int le=(lb-bl.begin());
int ri=(ub-bl.begin());
int cntt=0;
for(int l=le;l<ri;l++)
if(j<=bl[l].F&&bl[l].F<=j+2&&k<=bl[l].S&&bl[l].S<=k+2){
cntt++;
}
cnt[cntt]++;
}
}
}
}
int sum=0;
for(int i=1;i<=9;i++)sum+=cnt[i];
cout<<(ll)(h-2)*(w-2)-sum<<endl;
for(int i=1;i<=9;i++)cout<<cnt[i]<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:34:20: error: no matching function for call to 'max(long long int, int)'
34 | for(int k=max(1LL,bl[i].S-2);k<=min(bl[i].S,w-2);k++){
| ~~~^~~~~~~~~~~~~~~
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:34:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
34 | for(int k=max(1LL,bl[i].S-2);k<=min(bl[i].S,w-2);k++){
| ~~~^~~~~~~~~~~~~~~
/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:34:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
34 | for(int k=max(1LL,bl[i].S-2);k<=min(bl[i].S,w-2);k++){
| ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_less_iter::operator()(_Value&, _Iterator) const [with _Value = const std::pair<int, double>; _Iterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >]':
/usr/include/c++/14/bits/stl_algo.h:1993:14: required from '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<int, int>*, vector<pair<int, int> > >; _Tp = pair<int, double>; _Compare = __gnu_cxx::__ops::_Val_less_iter]'
1993 | if (__comp(__val, __middle))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2028:32: required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<pair<int, int>*, vector<pair<int, int> > >; _Tp = pair<int, double>]'
2028 | return std::__upper_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
2029 | __gnu_cxx::__ops::__val_less_iter());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:38:23: required from here
38 | auto ub=upper_bound(ALL(bl),mp(bl[i].F+2,INF));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:98:22: error: no match for 'operator<' (operand types are 'const std::pair<int, double>' and 'std::pair<int, int>')
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<int, double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<int, double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<int, double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/regex.h:1224: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>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<int, double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/regex.h:1317: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>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<int, double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<int, double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<int, double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: deduced conflic
|
s235453201
|
p04002
|
C++
|
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
ios::sync_with_stdio(false);
int dx[9] = {0,0,1,1,1,0,-1,-1,-1};
int dy[9] = {0,1,1,0,-1,-1,-1,0,1};
int main(){
map<PII,ll> f;
ll H,W,N;
cin >> H >> W >> N;
REP(i,N){
int a,b;
cin >> a >> b;
REP(j,9){
PII p = MP(a+dx[j],b+dy[j]);
f[p] = f[p] + 1;
}
}
ll ans[10] = {};
for(pair<PII, ll> p:f){
int a = (p.first).first;
int b = (p.first).second;
if ((a <= 1) or (b <= 1) or (a >= H) or (b >= W)) continue;
ans[p.second]++;
//cout << p.first << " " << p.second << endl;
}
ll em = 0;
FORq(i,1,9){
em += ans[i];
}
cout << ((H-2)*(W-2)-em) << "\n";
FORq(i,1,9){
cout << ans[i] << "\n";
}
}
|
a.cc:33:1: error: specializing member 'std::basic_ios<char>::sync_with_stdio' requires 'template<>' syntax
33 | ios::sync_with_stdio(false);
| ^~~
|
s190923416
|
p04002
|
C++
|
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)
vector<int> dz = {-2,-1,0,1,2};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout<<setprecision(std::numeric_limits<float>::max_digits10);
ll h,w,n;
cin>>h>>w>>n;
vector<int> a(n);
vector<int> b(n);
rep(i,n) cin>>a[i]>>b[i];
unordered_map<int,unordered_map<int,int>> mp;
rep(i,n) {
mp[a[i]][b[i]]=1;
}
unordered_set<pair<int,int>> ps;
vector<ll> c(10);
ll s=0;
rep(i,n) {
rep(j,5) {
rep(k,5) {
int aa=a[i]+dz[j];
int bb=b[i]+dz[k];
if(1<=aa&&aa<=h-2&&1<=bb&&bb<=w-2)
ps.insert(make_pair(aa,bb));
}
}
}
c[0]=static_cast<ll>(h-2)*static_cast<ll>(w-2)-ps.size();
for(auto& p : ps) {
int aa,bb;
tie(aa,bb)=p;
int t=0;
rep(dx,3) {
rep(dy,3) {
t+=mp[aa+dx][bb+dy];
}
}
c[t]++;
}
rep(i,10) {
cout << c[i]<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:32: error: use of deleted function 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::pair<int, int>; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]'
24 | unordered_set<pair<int,int>> ps;
| ^~
In file included from /usr/include/c++/14/unordered_set:41,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:189,
from a.cc:1:
/usr/include/c++/14/bits/unordered_set.h:142:7: note: 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::pair<int, int>; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]' is implicitly deleted because the default definition would be ill-formed:
142 | unordered_set() = default;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_set.h: At global scope:
/usr/include/c++/14/bits/unordered_set.h:142:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]'
In file included from /usr/include/c++/14/bits/unordered_map.h:33,
from /usr/include/c++/14/unordered_map:41,
from /usr/include/c++/14/functional:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]' is implicitly deleted because the default definition would be ill-formed:
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]'
In file included from /usr/include/c++/14/bits/hashtable.h:35:
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]' is implicitly deleted because the default definition would be ill-formed:
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _ExtractKey = std::__detail::_Identity; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]'
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]':
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()'
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
In file included from /usr/include/c++/14/string_view:50,
from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()'
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]'
83 | __hash_enum(__hash_enum&&);
| ^~~~~~~~~~~
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _ExtractKey = std::__detail::_Identity; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed:
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed:
1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()'
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<int, int>, std::__detail::_Identity, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()'
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<int, int>, std::__detail::_Identity, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed:
1306 | struct _Hash_code_base
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<std::pair<int, int>, std::pair<int, int>, std::__detail::_Identity, std::equal_to<std::pair<int, int> >, std::hash<std::
|
s062397201
|
p04002
|
C++
|
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
map<pair<int,int>,int>mp;
int h , w , n , cnt[ 10 ] ;
int main(){
scanf( "%d%d%d" , &h , &w , &n ) ;
while( n -- ) {
int x , y ;
scanf( "%d%d" , &x , &y ) ;
for( int i = max( 1 , x - 2 ) ; i <= min( h - 2 , x ) ; i ++ ) {
for( int j = max( 1 , y - 2 ) ; j <= min( w - 2 , y ) ; j ++ ) {
mp[ make_pair<int,int>(i,j) ] ++ ;
}
}
}
map< pair<int,int> , int > :: iterator iter ;
iter = mp.begin() ;
while( iter != mp.end() ) {
cnt[ iter -> second ] ++ ;
iter ++ ;
n ++ ;
}
ll ans = 1ll * ( h - 2 ) * ( w - 2 ) ;
printf( "%lld\n" , ans - n - 1 ) ;
for( int i = 1 ; i <= 9 ; i ++ ) {
printf( "%d\n" , cnt[ i ] ) ;
}
return 0 ;
}
|
a.cc: In function 'int main()':
a.cc:18:56: error: cannot bind rvalue reference of type 'int&&' to lvalue of type 'int'
18 | mp[ make_pair<int,int>(i,j) ] ++ ;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1132:21: note: initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = int; _T2 = int; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = int; typename decay<_Tp>::type = int; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = int; typename decay<_Tp2>::type = int]'
1132 | make_pair(_T1&& __x, _T2&& __y)
| ~~~~~~^~~
|
s569639826
|
p04002
|
C++
|
#include<cstdio>
#include<vector>
#include<utility>
#include<algorithm>
#include<fstream>
using namespace std;
int main(){
long h,w,num[10]={},a,b;
int n,cnt=0;
vector<pair<long,long>> p;
scanf("%ld %ld %d",&h,&w,&n);
for(int i=0;i<n;i++){
scanf("%ld %ld",&a,&b);
for(long j=max((long)1,a-2);j<=min(a,h-2);j++)
for(long k=max((long)1,b-2);k<=min(b,w-2);k++)
p.push_back(make_pair(j,k));
}
a=b=0;
sort(p.begin(),p.end());
p.push_back(make_pair(h+1,w+1));
for(int i=0;i<p.size();i++){
if(a==p[i].first&&b==p[i].second)
cnt++;
else{
num[cnt]++;
cnt=1;
a=p[i].first;
b=p[i].second;
}
}
num[0]=(h-2)*(w-2);
for(int i=1;i<=9;i++)
num[0]-=num[i];
//ofstream fout("out2.txt");
for(int i=0;i<10;i++)
cout << num[i] << endl;
}
|
a.cc: In function 'int main()':
a.cc:38:5: error: 'cout' was not declared in this scope
38 | cout << num[i] << endl;
| ^~~~
a.cc:6:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
5 | #include<fstream>
+++ |+#include <iostream>
6 | using namespace std;
|
s780958129
|
p04002
|
C
|
/*
cat <<EOF >mistaken-paste
*/
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#define BIG 2000000007
#define VERYBIG 200000000000007LL
#define MOD 1000000007
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 200000
#define M_MAX 400
#ifdef __cplusplus
#include <queue>
#include <stack>
// #include <tuple>
using namespace std; // I'm NOT gonna use C++ without compro. shit
typedef priority_queue<ull, vector<ull>, greater<ull> > upque123;
typedef priority_queue<ull, vector<ull> > upque321;
typedef priority_queue<sll, vector<sll>, greater<sll> > spque123;
typedef priority_queue<sll, vector<sll> > spque321;
#endif
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
hwll a;
hwll b;
} linell;
typedef struct {
ull s;
ull t;
int32_t c;
} struct_a;
typedef struct {
int32_t from;
int32_t to;
sll cost;
} struct_b;
const hw vector8[8] = {
{-1, -1},
{-1, 0},
{-1, +1},
{ 0, -1},
{ 0, +1},
{+1, -1},
{+1, 0},
{+1, +1}
};
ull n, m;
ull h, w;
ull k;
ull q;
ull vua, vub, vuc, vud, vue, vuf;
sll vsa, vsb, vsc, vsd, vse, vsf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
size_t slen;
size_t tlen;
char ch, dh;
void swap_adj (ull *a, ull *b) {
if (*a != *b) {
ull tmp = *b;
*b = *a;
*a = tmp;
}
return;
}
ull divide (ull a, ull b) {
ull x = MOD - 2;
ull ans = 1;
while (x) {
if (x & 1) ans = (ans * b) % MOD;
b = (b * b) % MOD;
x /= 2;
}
return (a * ans) % MOD;
}
int32_t digits (ull x) {
int32_t i = 1;
while (x >= 10) {
x /= 10;
i++;
}
return i;
}
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
int32_t targetdig (ull x, int32_t index /* 1-indexed */) {
// static...?
int32_t posmax = digits(x);
if (posmax < index) return -1;
while (posmax > index) {
posmax--;
x /= 10;
}
return x % 10;
}
int32_t charcomp (const char left, const char right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int32_t pcharcomp (const void *left, const void *right) {
char lval = *(char*)left;
char rval = *(char*)right;
return charcomp(lval, rval);
}
int32_t intcomp (const int32_t left, const int32_t right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int32_t pintcomp (const void *left, const void *right) {
int lval = *(int*)left;
int rval = *(int*)right;
return intcomp(lval, rval);
}
int32_t ullcomp (const ull left, const ull right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int32_t pullcomp (const void *left, const void *right) {
ull lval = *(ull*)left;
ull rval = *(ull*)right;
return ullcomp(lval, rval);
}
int32_t pullrevcomp (const void *left, const void *right) {
ull lval = *(ull*)left;
ull rval = *(ull*)right;
return -ullcomp(lval, rval);
}
int32_t sllcomp (const sll left, const sll right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int32_t psllcomp (const void *left, const void *right) {
sll lval = *(sll*)left, rval = *(sll*)right;
return ullcomp(lval, rval);
}
int32_t hwllfraccomp (const hwll left, const hwll right) {
return ullcomp(left.a * right.b, left.b * right.a);
}
int32_t phwAcomp (const hw *left, const hw *right) {
return intcomp(left->a, right->a);
}
int32_t phwBcomp (const hw *left, const hw *right) {
return intcomp(left->b, right->b);
}
int32_t phwABcomp (const hw *left, const hw *right) {
int32_t x = phwAcomp(left, right);
if (x) return x;
return phwBcomp(left, right);
}
int32_t phwllAcomp (const hwll *left, const hwll *right) {
return sllcomp(left->a, right->a);
}
int32_t phwllBcomp (const hwll *left, const hwll *right) {
return sllcomp(left->b, right->b);
}
int32_t phwllABcomp (const void *left, const void *right) {
hwll lval = *(hwll*)left, rval = *(hwll*)right;
int32_t x = sllcomp(lval.a, rval.a);
if (x) return x;
return sllcomp(lval.b, rval.b);
}
int32_t phwllrAcBcomp (const hwll *left, const hwll *right) {
int32_t x = -phwllAcomp(left, right);
if (x) return x;
return phwllBcomp(left, right);
}
int32_t phwllBAcomp (const hwll *left, const hwll *right) {
int32_t x = phwllBcomp(left, right);
if (x) return x;
return phwllAcomp(left, right);
}
int32_t pstrAcomp (const struct_a *left, const struct_a *right) {
int32_t x;
if (x = ullcomp(left->t, right->t)) return x;
if (x = ullcomp(left->s, right->s)) return x;
if (x = intcomp(left->c, right->c)) return x;
return 0;
}
int32_t bitlet (char c) {
return (1 << (c - 'a'));
}
ull ullabs (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sllabs (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll nibutanlobo (bool (*func)(sll arg), sll ok, sll ng) {
while (sllabs(ok, ng) > 1) {
sll med = (ok + ng) / 2;
if (func(med)) {
ok = med;
} else {
ng = med;
}
// printf("debug: [%lld %lld)\n", ok, ng);
}
if (!func(ok)) return ok * 2 - ng;
return ok;
}
bool nextrouteint (int32_t arr[], int32_t n) {
int32_t i = n - 1;
int32_t j, x;
while (i > 0 && arr[i - 1] > arr[i]) i--;
if (i == 0) return false;
x = n;
for (j = i; j < n; j++) {
if (arr[j] < arr[i - 1]) continue;
if (x == n || arr[x] > arr[j]) x = j;
}
arr[i - 1] ^= arr[x];
arr[x] ^= arr[i - 1];
arr[i - 1] ^= arr[x];
qsort(&arr[i], n - i, sizeof(int32_t), pintcomp);
return true;
}
bool nextrouteull (ull arr[], int32_t n) {
int32_t i = n - 1;
int32_t j, x;
while (i > 0 && arr[i - 1] > arr[i]) i--;
if (i == 0) return false;
x = n;
for (j = i; j < n; j++) {
if (arr[j] < arr[i - 1]) continue;
if (x == n || arr[x] > arr[j]) x = j;
}
arr[i - 1] ^= arr[x];
arr[x] ^= arr[i - 1];
arr[i - 1] ^= arr[x];
qsort(&arr[i], n - i, sizeof(ull), pintcomp);
return true;
}
void printUquotient (ull left, ull right) {
const int32_t digits = 20;
printf("%llu.", left / right);
left %= right;
for (int32_t i = 0; i < digits; i++) {
left *= 10;
printf("%1d", left / right);
left %= right;
}
puts("");
return;
}
void printSquotient (sll left, sll right) {
if (left * right < 0) putchar('-');
printUquotient(sllabs(left, 0), sllabs(right, 0));
return;
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
#ifdef __cplusplus
typedef struct {
int32_t to;
sll cost;
} edge;
typedef pair<sll, int32_t> P;
std::vector<edge> g[N_MAX];
void dijk_init (ull n, struct_b arr[]) {
edge x;
for (int32_t i = 0; i < n; i++) {
x.to = arr[i].to;
x.cost = arr[i].cost;
g[arr[i].from].push_back(x);
}
}
void dijk_distinit (int s, sll distance[], ull n) {
for (int32_t i = 0; i < n; i++) {
distance[i] = BIG;
}
distance[s] = 0;
return;
}
bool dijkstra (int s, sll distance[]) {
priority_queue<P, std::vector<P>, greater<P> > que; // (最短距離, 頂点番号)
que.push(P(distance[s], s));
bool ischanged = false;
while (!que.empty()) {
P p = que.top();
que.pop();
sll v = p.second;
if (distance[v] < p.first) continue;
int32_t maxsize = g[v].size();
for (int32_t i = 0; i < maxsize; i++) {
edge e = g[v][i];
if (distance[e.to] > distance[v] + e.cost) {
distance[e.to] = distance[v] + e.cost;
ischanged = true;
que.push(P(distance[e.to], e.to));
}
}
}
return ischanged;
}
#endif
sll dist[N_MAX];
struct_b path[M_MAX * 2];
ull a[N_MAX];
// sll a[N_MAX];
// ull a[N_MAX][N_MAX];
// sll a[N_MAX][N_MAX];
ull b[N_MAX];
// sll b[N_MAX];
ull c[N_MAX];
// char c[N_MAX];
// char s[N_MAX + 1];
// char s[N_MAX + 1][N_MAX + 1];
// char s[N_MAX + 1][M_MAX + 1];
// char t[N_MAX + 1];
ull alphabets[26];
// char alphabets[26];
// ull dp[N_MAX + 1];
// ull dp[N_MAX + 1][N_MAX + 1];
// bool dp[N_MAX + 1];
// bool dp[N_MAX + 1][N_MAX + 1];
hwll arr[N_MAX];
// typedef tuple<sll, int32_t, int32_t> P2d;
// ull dp[N_MAX + 1][N_MAX + 1];
typedef pair<sll, sll> sllpair;
typedef priority_queue<sllpair, vector<sllpair>, greater<sllpair> > pairpque;
ull answerdp[10];
double distance (sll x1, sll y1, sll x2, sll y2) {
double xdist2, ydist2, origindist, dist;
xdist2 = (x1 - x2) * (x1 - x2);
ydist2 = (y1 - y2) * (y1 - y2);
return sqrt(xdist2 + ydist2);
}
ull solve () {
sll i, j, ki, l;
ull result = 0;
// sll result = 0;
// double result = 0;
ull maybe = 0;
// sll maybe = 0;
ull sum = 0;
// sll sum = 0;
ull item;
ull *dpcell;
// qsortの際には"p"ullcompを使う
// slen = strlen(s);
// for (i = 0; i <= slen; i++) {
// for (j = 0; j <= slen; j++) {
// dp[i][j] = BIG;
// }
// }
// dp[0][0] = 0;
// for (i = 1; i <= slen; i++) {
// for (j = 0; j <= slen; j++) {
// int natural = ((s[i - 1] == '(') ? +1 : -1);
// if (0 <= j - natural && j - natural <= slen) {
// dp[i][j] = umin(dp[i][j], dp[i - 1][j - natural]);
// }
// if (0 <= j + natural && j + natural <= slen) {
// dp[i][j] = umin(dp[i][j], dp[i - 1][j + natural] + 1);
// }
// // printf("[%lld][%lld] %llu\n", i, j, dp[i][j]);
// }
// }
pairpque q;
for (i = 0; i < n; i++) {
q.push(sllpair(arr[i].a, arr[i].b));
for (j = 0; j < 8; j++) {
sll x = arr[i].a + vector8[j].a;
sll y = arr[i].b + vector8[j].b;
// if (x > 0 && x < (sll)h - 1 && y > 0 && y < (sll)w - 1) {
q.push(sllpair(x, y));
// }
}
}
while (!q.empty()) {
sllpair current = q.top();
if (current.first <= 0 || current.first >= h - 1 || current.second <= 0 || current.second >= w - 1) {
q.pop();
continue;
}
sum = 0;
while (!q.empty() && q.top() == current) {
q.pop();
sum++;
}
// printf("<%llu %llu>: %llu\n", current.first, current.second, sum);
answerdp[sum]++;
}
answerdp[0] = (h - 2) * (w - 2);
for (i = 1; i <= 9; i++) {
answerdp[0] -= answerdp[i];
}
for (i = 0; i <= 9; i++) {
printf("%llu\n", answerdp[i]);
}
// printf("%llu\n", result);
// printf("%.12lf\n", (double)result);
// puts(s);
return 0;
success:
puts("YES");
// puts("Yes");
// printf("%llu\n", result);
// puts("0");
// puts("Alice");
return 0;
fail:
// puts("NO");
// puts("No");
// puts("0");
puts("-1");
// puts("-1 -1 -1");
// puts("Eel");
return 1;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
// scanf("%lf%lf", &vda, &vdb);
// scanf("%lld%lld%lld%lld", &vsa, &vsb, &vsc, &vsd);
// scanf("%llu%llu", &vua, &vub, &vuc, &vud);
scanf("%llu%llu", &h, &w);
scanf("%llu", &n, &m);
// scanf("%*llu");
// scanf("%llu", &k, &m, &n);
// scanf("%llu%llu%llu%llu%llu%llu", &vua, &vub, &vuc, &vud, &vue, &vuf);
// scanf("%lld", &vsa, &vsb, &vsc);
// scanf("%s", s);
// scanf("%s", t);
// scanf("%llu", &k);
// for (i = 1; i < n; i++) {
// scanf("%llu", &a[i]);
// // a[i]--;
// }
// for (i = 0; i < m; i++) {
// scanf("%llu", &b[i]);
// }
// for (i = 0; i < n; i++) {
// scanf("%s", s[i]);
// }
// scanf("%s", t);
for (i = 0; i < n; i++) {
// scanf("%llu", &c[i]);
scanf("%llu", &arr[i].a);
scanf("%llu", &arr[i].b);
arr[i].a--;
arr[i].b--;
}
// for (i = 0; i < n; i++) {
// for (j = 0; j < n; j++) {
// scanf("%llu", &a[i][j]);
// }
// }
// for (i = 0; i < n; i++) {
// scanf("%llu%llu%llu", &a[i], &b[i], &c[i]);
// }
// scanf("%llu", &q);
// for (i = 0; i < q; i++) {
// // scanf("%s%s", s, t);
// // solve();
// }
// for (i = 0; i < m; i++) {
// scanf("%llu%llu", &arr[i].a, &arr[i].b);
// arr[i].a--;
// arr[i].b--;
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < m; j++) {
// scanf("%llu", &a[i][j]);
// a[i][j]--;
// }
// }
solve();
// for (i = 0; i < m; i++) {
// scanf("%llu%llu%llu", &vua, &vub, &vuc);
// // scanf("%s%s", s, t);
// // scanf("%f%f%f", &vda, &vdb, &vdc);
// // scanf("%s", s);
// solve();
// }
// while (scanf("%llu%llu", &n, &k), n + k) {
// for (i = 0; i < n; i++) {
// scanf("%llu", &a[i]);
// }
// solve();
// }
return 0;
}
|
main.c:481:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
481 | typedef pair<sll, sll> sllpair;
| ^
main.c:482:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
482 | typedef priority_queue<sllpair, vector<sllpair>, greater<sllpair> > pairpque;
| ^
main.c: In function 'solve':
main.c:528:9: error: unknown type name 'pairpque'
528 | pairpque q;
| ^~~~~~~~
main.c:530:18: error: request for member 'push' in something not a structure or union
530 | q.push(sllpair(arr[i].a, arr[i].b));
| ^
main.c:530:24: error: implicit declaration of function 'sllpair' [-Wimplicit-function-declaration]
530 | q.push(sllpair(arr[i].a, arr[i].b));
| ^~~~~~~
main.c:535:34: error: request for member 'push' in something not a structure or union
535 | q.push(sllpair(x, y));
| ^
main.c:540:18: error: request for member 'empty' in something not a structure or union
540 | while (!q.empty()) {
| ^
main.c:541:17: error: unknown type name 'sllpair'
541 | sllpair current = q.top();
| ^~~~~~~
main.c:541:36: error: request for member 'top' in something not a structure or union
541 | sllpair current = q.top();
| ^
main.c:543:28: error: request for member 'first' in something not a structure or union
543 | if (current.first <= 0 || current.first >= h - 1 || current.second <= 0 || current.second >= w - 1) {
| ^
main.c:543:50: error: request for member 'first' in something not a structure or union
543 | if (current.first <= 0 || current.first >= h - 1 || current.second <= 0 || current.second >= w - 1) {
| ^
main.c:543:76: error: request for member 'second' in something not a structure or union
543 | if (current.first <= 0 || current.first >= h - 1 || current.second <= 0 || current.second >= w - 1) {
| ^
main.c:543:99: error: request for member 'second' in something not a structure or union
543 | if (current.first <= 0 || current.first >= h - 1 || current.second <= 0 || current.second >= w - 1) {
| ^
main.c:544:26: error: request for member 'pop' in something not a structure or union
544 | q.pop();
| ^
main.c:549:26: error: request for member 'empty' in something not a structure or union
549 | while (!q.empty() && q.top() == current) {
| ^
main.c:549:39: error: request for member 'top' in something not a structure or union
549 | while (!q.empty() && q.top() == current) {
| ^
main.c:550:26: error: request for member 'pop' in something not a structure or union
550 | q.pop();
| ^
|
s455961352
|
p04002
|
C++
|
module SqIntMap = Map.Make (struct
type t = int * int
let compare = compare
end)
module IntMap = Map.Make (struct
type t = int
let compare = compare
end)
let () =
let h, w, n = Scanf.scanf "%d %d %d\n" (fun h w n -> h, w, n) in
let abs = Array.init n (fun _ -> Scanf.scanf "%d %d\n" (fun a b -> a, b)) in
let dxdys = List.concat @@ Array.to_list @@ Array.init 3 (fun i -> Array.to_list @@ Array.init 3 (fun j -> (i - 2, j - 2))) in
Array.fold_left (fun m (a, b) ->
List.fold_left (fun m (dx, dy) ->
if 1 <= a + dy && a + dy <= h - 2 && 1 <= b + dx && b + dx <= w - 2 then
SqIntMap.add (a + dy, b + dx) (1 + try SqIntMap.find (a + dy, b + dx) m with Not_found -> 0) m
else m) m dxdys) SqIntMap.empty abs
|> (fun m -> SqIntMap.fold (fun _ i m -> IntMap.add i (1 + try IntMap.find i m with Not_found -> 0) m) m IntMap.empty)
|> (fun m ->
Array.init 10 (function
| 0 -> (h - 2) * (w - 2) - IntMap.fold (fun _ -> ( + )) m 0
| n -> try IntMap.find n m with Not_found -> 0))
|> Array.iter (Printf.printf "%d\n")
|
a.cc:14:27: error: stray '@' in program
14 | let dxdys = List.concat @@ Array.to_list @@ Array.init 3 (fun i -> Array.to_list @@ Array.init 3 (fun j -> (i - 2, j - 2))) in
| ^
a.cc:14:28: error: stray '@' in program
14 | let dxdys = List.concat @@ Array.to_list @@ Array.init 3 (fun i -> Array.to_list @@ Array.init 3 (fun j -> (i - 2, j - 2))) in
| ^
a.cc:14:44: error: stray '@' in program
14 | let dxdys = List.concat @@ Array.to_list @@ Array.init 3 (fun i -> Array.to_list @@ Array.init 3 (fun j -> (i - 2, j - 2))) in
| ^
a.cc:14:45: error: stray '@' in program
14 | let dxdys = List.concat @@ Array.to_list @@ Array.init 3 (fun i -> Array.to_list @@ Array.init 3 (fun j -> (i - 2, j - 2))) in
| ^
a.cc:14:84: error: stray '@' in program
14 | let dxdys = List.concat @@ Array.to_list @@ Array.init 3 (fun i -> Array.to_list @@ Array.init 3 (fun j -> (i - 2, j - 2))) in
| ^
a.cc:14:85: error: stray '@' in program
14 | let dxdys = List.concat @@ Array.to_list @@ Array.init 3 (fun i -> Array.to_list @@ Array.init 3 (fun j -> (i - 2, j - 2))) in
| ^
a.cc:1:1: error: 'module' does not name a type
1 | module SqIntMap = Map.Make (struct
| ^~~~~~
a.cc:1:1: note: C++20 'module' only available with '-fmodules-ts'
|
s938550007
|
p04002
|
C++
|
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<ll, ll> P;
int main()
{
ll H, W, N; cin >> H >> W >> N;
map<P, int> MAP;
int vy[4] = {-1, -1, 0, 1, 1, 1, 0, -1};
int vx[4] = {0, 1, 1, 1, 0, -1, -1, -1};
FOR(i,0,N) {
ll y, ll x; cin >> y >> x;
FOR(j,0,8) {
ll ny = y + vy[j];
ll nx = x + vx[j];
if(ny <= 0 || ny >= H - 1 || nx <= 0 || nx >= W - 1) continue;
MAP[P(ny, nx)]++;
}
ll ans[9] = {0};
for(auto &itr = MAP.begin(); itr != MAP.end(); itr++) {
ans[itr->second]++;
}
ans[0] = (H - 2) * (W - 2);
FOR(i,1,9) ans[0] -= ans[i];
FOR(i,0,9) cout << ans[i] << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:25:41: error: too many initializers for 'int [4]'
25 | int vy[4] = {-1, -1, 0, 1, 1, 1, 0, -1};
| ^
a.cc:26:41: error: too many initializers for 'int [4]'
26 | int vx[4] = {0, 1, 1, 1, 0, -1, -1, -1};
| ^
a.cc:28:14: error: expected initializer before 'x'
28 | ll y, ll x; cin >> y >> x;
| ^
a.cc:28:29: error: 'x' was not declared in this scope
28 | ll y, ll x; cin >> y >> x;
| ^
a.cc:36:28: error: cannot bind non-const lvalue reference of type 'std::_Rb_tree_iterator<std::pair<const std::pair<long long int, long long int>, int> >&' to an rvalue of type 'std::map<std::pair<long long int, long long int>, int>::iterator' {aka 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, int>, std::_Select1st<std::pair<const std::pair<long long int, long long int>, int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<const std::pair<long long int, long long int>, int> > >::iterator'}
36 | for(auto &itr = MAP.begin(); itr != MAP.end(); itr++) {
| ~~~~~~~~~^~
a.cc:43:2: error: expected '}' at end of input
43 | }
| ^
a.cc:22:1: note: to match this '{'
22 | {
| ^
|
s506142771
|
p04002
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#define MOD 1000000007
#define ll long long;
using namespace std;
int main()
{
ll int h, w, n, flag,len;
int a[100005];
int b[100005];
ll int c[1000006] = {};
cin >> h >> w >> n;
int i,j,k;
long long int ans[10] = {};
len = -1;
for (i = 0; i < n; i++){
cin >> a[i] >> b[i];
}
for (i = 0; i < n; i++){
for (j = 0; j < 3; j++){
for (k = 0; k < 3; k++){
if (a[i] - 1 + j >= 2 && a[i] - 1 + j <= h-1 && b[i] - 1 + k >= 2 && b[i] - 1 + k <= w-1){
len = len + 1;
c[len] = (a[i] - 1 + j) * w + (b[i] - 1 + k);
}
}
}
}
if (len != -1){
sort(begin(c), begin(c) + len);
}
flag = 1;
for (i = 0; i < len+1; i++){
if (c[i] == c[i + 1]){
flag = flag + 1;
}
else{
ans[flag] += 1;
flag = 1;
}
}
ans[0] = (h - 2)*(w - 2) - ans[1] - ans[2] - ans[3] - ans[4] - ans[5] - ans[6] - ans[7] - ans[8] - ans[9];
if (ans[0] <= 0){
ans[0] = 0;
}
for (i = 0; i < 10; i++){
cout << ans[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
6 | #define ll long long;
| ^~~~
a.cc:11:9: note: in expansion of macro 'll'
11 | ll int h, w, n, flag,len;
| ^~
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
6 | #define ll long long;
| ^~~~
a.cc:14:9: note: in expansion of macro 'll'
14 | ll int c[1000006] = {};
| ^~
|
s635520485
|
p04002
|
C++
|
1
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1
| ^
|
s488026171
|
p04002
|
Java
|
import java.util.Scanner;
import java.awt.Point;
public class Main{
public static void main(String[] args){
new Main().solve();
}
public void solve(){
Scanner scanner = new Scanner(System.in);
long H = scanner.nextLong();
long W = scanner.nextLong();
int N = scanner.nextInt();
Point[] point = new Point[N];
for(int i=0; i<N; i++){
int row = scanner.nextInt();
int col = scanner.nextInt();
point[i] = new Point(col, row);
}
HashMap<Point,Integer> hashmap = new HashMap<Point,Integer>();
for(int i=0; i<N; i++){
for(int y=-1; y<2; y++){
for(int x=-1; x<2; x++){
Point p = new Point(point[i].x+x, point[i].y+y);
if(hashmap.get(p) == null){
hashmap.put(p,1);
}else{
hashmap.put(p,hashmap.get(p)+1);
}
}
}
}
long[] counter = new long[10];
for(int i=0; i<counter.length; i++){
counter[i] = 0;
}
for(HashMap.Entry<Point,Integer> map : hashmap.entrySet()){
if(1<map.getKey().x && map.getKey().x<W && 1<map.getKey().y && map.getKey().y<H){
counter[map.getValue()]++;
}
}
for(int i=0; i<counter.length; i++){
System.out.println(counter[i]);
}
}
}
|
Main.java:22: error: cannot find symbol
HashMap<Point,Integer> hashmap = new HashMap<Point,Integer>();
^
symbol: class HashMap
location: class Main
Main.java:22: error: cannot find symbol
HashMap<Point,Integer> hashmap = new HashMap<Point,Integer>();
^
symbol: class HashMap
location: class Main
Main.java:41: error: package HashMap does not exist
for(HashMap.Entry<Point,Integer> map : hashmap.entrySet()){
^
3 errors
|
s709489472
|
p04002
|
C++
|
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<complex>
#include<set>
#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 all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int h,w;
int n;
int b[100006];
int a[100006];
set<P> st;
int Count;
set<P> used;
int da[3]={-1,0,1};
int db[3]={-1,0,1};
int ans[11];
int main()
{
cin>>h>>w;
cin>>n;
rep(i,n)
{
cin>>a[i];
cin>>b[i];
st.insert(P(a[i],b[i]));
}
rep(i,n)
{
rep(j,3)rep(k,3)
{
int aa=a[i]+da[j];
int bb=b[i]+db[k];
if(!(2<=aa&&aa<=h-1&&2<=bb&&bb<=w-1))continue;
if(used.find(P(aa,bb))!=used.end())continue;
used.insert(P(aa,bb));
Count=0;
rep(r,3)rep(l,3)
{
if(st.find(P(aa+da[r],bb+db[l]))!=st.end())
{
Count++;
}
}
ans[Count]++;
}
}
ans[0]=(h-2)*(w-2);
rep2(i,1,10)
{
ans[0]-=ans[i];
}
rep(i,10)
{
cout<<ans[i]<<endl;
}
return 0;
}#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<complex>
#include<set>
#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 all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int h,w;
int n;
int b[100006];
int a[100006];
set<P> st;
int Count;
set<P> used;
int da[3]={-1,0,1};
int db[3]={-1,0,1};
int ans[11];
int main()
{
cin>>h>>w;
cin>>n;
rep(i,n)
{
cin>>a[i];
cin>>b[i];
st.insert(P(a[i],b[i]));
}
rep(i,n)
{
rep(j,3)rep(k,3)
{
int aa=a[i]+da[j];
int bb=b[i]+db[k];
if(!(2<=aa&&aa<=h-1&&2<=bb&&bb<=w-1))continue;
if(used.find(P(aa,bb))!=used.end())continue;
used.insert(P(aa,bb));
Count=0;
rep(r,3)rep(l,3)
{
if(st.find(P(aa+da[r],bb+db[l]))!=st.end())
{
Count++;
}
}
ans[Count]++;
}
}
ans[0]=(h-2)*(w-2);
rep2(i,1,10)
{
ans[0]-=ans[i];
}
rep(i,10)
{
cout<<ans[i]<<endl;
}
return 0;
}
|
a.cc:70:2: error: stray '#' in program
70 | }#include<iostream>
| ^
a.cc:70:3: error: 'include' does not name a type
70 | }#include<iostream>
| ^~~~~~~
a.cc:89:5: error: redefinition of 'int h'
89 | int h,w;
| ^
a.cc:20:5: note: 'int h' previously declared here
20 | int h,w;
| ^
a.cc:89:7: error: redefinition of 'int w'
89 | int h,w;
| ^
a.cc:20:7: note: 'int w' previously declared here
20 | int h,w;
| ^
a.cc:90:5: error: redefinition of 'int n'
90 | int n;
| ^
a.cc:21:5: note: 'int n' previously declared here
21 | int n;
| ^
a.cc:91:5: error: redefinition of 'int b [100006]'
91 | int b[100006];
| ^
a.cc:22:5: note: 'int b [100006]' previously declared here
22 | int b[100006];
| ^
a.cc:92:5: error: redefinition of 'int a [100006]'
92 | int a[100006];
| ^
a.cc:23:5: note: 'int a [100006]' previously declared here
23 | int a[100006];
| ^
a.cc:93:8: error: redefinition of 'std::set<std::pair<int, int> > st'
93 | set<P> st;
| ^~
a.cc:24:8: note: 'std::set<std::pair<int, int> > st' previously declared here
24 | set<P> st;
| ^~
a.cc:94:5: error: redefinition of 'int Count'
94 | int Count;
| ^~~~~
a.cc:25:5: note: 'int Count' previously declared here
25 | int Count;
| ^~~~~
a.cc:95:8: error: redefinition of 'std::set<std::pair<int, int> > used'
95 | set<P> used;
| ^~~~
a.cc:26:8: note: 'std::set<std::pair<int, int> > used' previously declared here
26 | set<P> used;
| ^~~~
a.cc:96:5: error: redefinition of 'int da [3]'
96 | int da[3]={-1,0,1};
| ^~
a.cc:27:5: note: 'int da [3]' previously defined here
27 | int da[3]={-1,0,1};
| ^~
a.cc:97:5: error: redefinition of 'int db [3]'
97 | int db[3]={-1,0,1};
| ^~
a.cc:28:5: note: 'int db [3]' previously defined here
28 | int db[3]={-1,0,1};
| ^~
a.cc:98:5: error: redefinition of 'int ans [11]'
98 | int ans[11];
| ^~~
a.cc:29:5: note: 'int ans [11]' previously declared here
29 | int ans[11];
| ^~~
a.cc:99:5: error: redefinition of 'int main()'
99 | int main()
| ^~~~
a.cc:30:5: note: 'int main()' previously defined here
30 | int main()
| ^~~~
|
s934365328
|
p04002
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
//vector<pair<int, int> > mass;
vector<ll> mass;
ll H, W, zero = 0, ans[10];
int N, A, B;
int main() {
cin >> H >> W >> N;
for (int i = 0; i < N; i++) {
cin >> A >> B;
for (int j = A - 1; j <= A + 1; j++) {
for (int k = B - 1; k <= B + 1; k++) {
// pair<int, int> p(j, k);
// mass.push_back(p);
mass.push_back(j*H+k);
}
}
}
sort(mass.begin(), mass.end());
for (int i = 0; i < mass.size(); i++) {
// if (mass[i].first > 1 && mass[i].first < H && mass[i].second > 1 && mass[i].second < W) {
if (mass[i]/H > 1 && mass[i]/H < H && mass[i]%H > 1 && mass[i]%H < W) {
int j = 0;
// pair<int, int> p(mass[i]);
ll p = mass[i];
zero++;
while (true) {
if (p == mass[i]) {
j++;
i++;
} else {
ans[j]++;
i--;
break;
}
}
}
}
ans[0] = (H - 2) * (W - 2) - zero;
for (int i = 0; i < 10; i++) {
cout << ans[i] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:24:9: error: 'sort' was not declared in this scope; did you mean 'short'?
24 | sort(mass.begin(), mass.end());
| ^~~~
| short
|
s740557165
|
p04002
|
C++
|
use std::collections::BTreeSet;
fn main() {
let (h, w, n) = {
let a = getvec::<i64>();
(a[0], a[1], a[2])
};
let mut black = BTreeSet::new();
let mut cand = BTreeSet::new();
for _ in 0..n {
let (y, x) = {
let a = getvec::<i64>();
(a[0], a[1])
};
black.insert((y, x));
for i in (y - 2)..(y + 1) {
for j in (x - 2)..(x + 1) {
if i > 0 && j > 0 && i < h - 1 && j < w - 1 {
cand.insert((i, j));
}
}
}
}
let mut ans = [0i64; 10];
for &p in &cand {
let (i, j) = p;
let mut sum : usize = 0;
for x in j..j + 3 {
for y in i..i + 3 {
if black.contains(&(y, x)) {
sum = sum + 1;
}
}
}
ans[sum] += 1;
}
ans[0] = (h - 2) * (w - 2);
for i in 1..10 {
ans[0] -= ans[i];
}
for i in 0..10 {
println!("{}", ans[i]);
}
}
fn next_line() -> String {
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
input
}
#[allow(dead_code)]
fn getnum<T : std::str::FromStr>() -> T {
let res = next_line();
let res = res.trim().parse::<T>().ok().unwrap();
res
}
#[allow(dead_code)]
fn getvec<T : std::str::FromStr>() -> Vec<T> {
let res = next_line();
let res : Vec<T> = res.split_whitespace().map(|x| x.parse::<T>().ok().unwrap()).collect();
return res;
}
|
a.cc:10:14: error: too many decimal points in number
10 | for _ in 0..n {
| ^~~~
a.cc:38:14: error: too many decimal points in number
38 | for i in 1..10 {
| ^~~~~
a.cc:41:14: error: too many decimal points in number
41 | for i in 0..10 {
| ^~~~~
a.cc:52:2: error: invalid preprocessing directive #[
52 | #[allow(dead_code)]
| ^
a.cc:59:2: error: invalid preprocessing directive #[
59 | #[allow(dead_code)]
| ^
a.cc:1:1: error: 'use' does not name a type
1 | use std::collections::BTreeSet;
| ^~~
a.cc:3:1: error: 'fn' does not name a type
3 | fn main() {
| ^~
a.cc:46:1: error: 'fn' does not name a type
46 | fn next_line() -> String {
| ^~
a.cc:53:1: error: 'fn' does not name a type
53 | fn getnum<T : std::str::FromStr>() -> T {
| ^~
a.cc:60:1: error: 'fn' does not name a type
60 | fn getvec<T : std::str::FromStr>() -> Vec<T> {
| ^~
|
s802455611
|
p04002
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
const int N = 100010;
int a[N], b[N];
map<pair<int, int> , int> hash;
long long ans[10];
int cal(int x, int y) {
int res = 0;
for (int i = x; i <= x + 2; i++)
for (int j = y; j <= y + 2; j++)
if (hash.find(make_pair(i, j)) != hash.end()) {
res++;
}
return res;
}
int main() {
int m, n, k;
scanf("%d %d %d", &m, &n, &k);
for (int i = 1; i <= k; i++) {
scanf("%d %d", &a[i], &b[i]);
hash[make_pair(a[i], b[i])] = 1;
}
for (int i = 1; i <= k; i++) {
for (int x = max(1, a[i] - 2); x <= a[i]; x++)
for (int y = max(1, b[i] - 2); y <= b[i]; y++) {
if (x + 2 > m || y + 2 > n) continue;
int d = cal(x, y);
ans[d] ++;
}
}
ans[0] = (long long)(m - 2) * (n - 2);
for (int i = 1; i <= 9; i++) {
ans[i] /= i;
ans[0] -= ans[i];
}
for (int i = 0; i <= 9; i++)
printf("%lld\n", ans[i]);
return 0;
}
|
a.cc: In function 'int cal(int, int)':
a.cc:19:29: error: reference to 'hash' is ambiguous
19 | if (hash.find(make_pair(i, j)) != hash.end()) {
| ^~~~
In file included from /usr/include/c++/14/string_view:50,
from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:12:27: note: 'std::map<std::pair<int, int>, int> hash'
12 | map<pair<int, int> , int> hash;
| ^~~~
a.cc:19:59: error: reference to 'hash' is ambiguous
19 | if (hash.find(make_pair(i, j)) != hash.end()) {
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:12:27: note: 'std::map<std::pair<int, int>, int> hash'
12 | map<pair<int, int> , int> hash;
| ^~~~
a.cc: In function 'int main()':
a.cc:30:17: error: reference to 'hash' is ambiguous
30 | hash[make_pair(a[i], b[i])] = 1;
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:12:27: note: 'std::map<std::pair<int, int>, int> hash'
12 | map<pair<int, int> , int> hash;
| ^~~~
|
s150475181
|
p04002
|
C++
|
#include <iostream>
using namespace std;
int main(){
int H,W,N;
cin>>H,W,N;
int arr[H][W]={};
int a,b;
for(int i=0;i<N;i++){
cin>>a,b;
arr[a][b]=1;
}
int hist[10]={};
for(int i=0;i<H-2;i++){
for(int j=0;j<W-2;j++){
int temp=arr[i][j]+arr[i+1][j]+arr[i+2][j]+arr[i][j+1]+arr[i+1][j+1]+arr[i+2][j+1]+arr[i][j+2]+arr[i+1][j+2]+arr[i+2][j+2];
hist[temp]++;
}
}
for(int k=0;k<10;k++)
{
cout<<count<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:21:11: error: 'count' was not declared in this scope
21 | cout<<count<<endl;
| ^~~~~
|
s121164368
|
p04002
|
C++
|
#include <iostream>
using namespace std;
int main(){
int H,W,N;
cin>>H,W,N;
int arr[H][W]={};
int a,b;
for(int i=0;i<N;i++){
cin>>a,b;
arr[a][b]=1;
}
int hist[10]={};
for(int i=0;i<H-2;i++){
for(int j=0;j<W-2;j++){
int temp=arr[i][j]+arr[i+1][j]+arr[i+2][j]+arr[i][j+1]+arr[i+1][j+1]+arr[i+2][j+1]+arr[i][j+2]+arr[i+1][j+2]+arr[i+2][j+2];
hist[temp]++
}
}
for(int k=0;k<10;k++)
{
cout<<count<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:25: error: expected ';' before '}' token
16 | hist[temp]++
| ^
| ;
17 | }
| ~
a.cc:21:11: error: 'count' was not declared in this scope
21 | cout<<count<<endl;
| ^~~~~
|
s108452505
|
p04002
|
C++
|
#include <iostream>
using namespace std;
int main(){
int H,W,N;
cin>>H,W,N;
int arr[H][W]={};
int a,b;
for(int i=0;i<N;i++){}
cin>>a,b;
arr[a][b]=1;
}
for(int k=0;k<10;k++)
{
int count=0;
for(int i=0;i<H-2;i++){
for(int j=0;j<W-2;j++){
int temp=arr[i][j]+arr[i+1][j]+arr[i+2][j]+arr[i][j+1]+arr[i+1][j+1]+arr[i+2][j+1]+arr[i][j+2]+arr[i+1][j+2]+arr[i+2][j+2];
if(temp==k){
count++;
}
}
}
cout<<count<<endl;
}
cout<<help(s,0)<<endl;
return 0;
}
|
a.cc:13:1: error: expected unqualified-id before 'for'
13 | for(int k=0;k<10;k++)
| ^~~
a.cc:13:13: error: 'k' does not name a type
13 | for(int k=0;k<10;k++)
| ^
a.cc:13:18: error: 'k' does not name a type
13 | for(int k=0;k<10;k++)
| ^
a.cc:30:1: error: 'cout' does not name a type
30 | cout<<help(s,0)<<endl;
| ^~~~
a.cc:32:1: error: expected unqualified-id before 'return'
32 | return 0;
| ^~~~~~
a.cc:33:1: error: expected declaration before '}' token
33 | }
| ^
|
s340987398
|
p04002
|
C++
|
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<set>
using namespace std;
const double pi=4*atan(1.0);
constexpr long long mod=static_cast<long long>(1e9+7);
using cEdges=vector<vector<int>>;
int BinarySearch(int begin,int end,function<bool(int,int&,int&)> func){
while(1){
int mid=(end-begin)/2+begin;
if(mid==begin){
bool ans=func(mid,begin,end);
if(!ans)++mid;
return mid;
}
func(mid,begin,end);
}
}
int main() {
long long H,W,N;
cin>>H>>W>>N;
unordered_set<pair<int,int>> Set;
for(int i=0;i<N;++i){
int a,b;
cin>>a>>b;
--a,--b;
Set.insert(make_pair(a,b));
}
array<long long,10> ans;
ans.fill(0);
for(const auto& p:Set){
bool arr[5][5];
for(int i=0;i<5;++i){
for(int j=0;j<5;++j){
if(Set.find(make_pair(p.first+i-2,p.second+j-2))!=Set.end())arr[i][j]=true;
else arr[i][j]=false;
}
}
for(int i=0;i<3;++i){
for(int j=0;j<3;++j){
if(0<=p.first+i-2 && p.first+i<H && 0<=p.second+j-2 && p.second+j<W){
int num=0;
for(int k=0;k<3;++k){
for(int l=0;l<3;++l){
if(arr[i+k][j+l])++num;
}
}
++ans[num];
}
}
}
}
long long sum=0;
for(int i=1;i<10;++i){
ans[i]/=i;
sum+=ans[i];
}
ans[0]=(H-2)*(W-2)-sum;
for(const auto& val:ans)
cout<<val<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:42:38: error: use of deleted function 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::pair<int, int>; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]'
42 | unordered_set<pair<int,int>> Set;
| ^~~
In file included from /usr/include/c++/14/unordered_set:41,
from a.cc:13:
/usr/include/c++/14/bits/unordered_set.h:142:7: note: 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::pair<int, int>; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]' is implicitly deleted because the default definition would be ill-formed:
142 | unordered_set() = default;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_set.h: At global scope:
/usr/include/c++/14/bits/unordered_set.h:142:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]'
In file included from /usr/include/c++/14/bits/unordered_map.h:33,
from /usr/include/c++/14/unordered_map:41,
from /usr/include/c++/14/functional:63,
from a.cc:10:
/usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]' is implicitly deleted because the default definition would be ill-formed:
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]'
In file included from /usr/include/c++/14/bits/hashtable.h:35:
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]' is implicitly deleted because the default definition would be ill-formed:
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _ExtractKey = std::__detail::_Identity; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]'
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]':
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()'
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
In file included from /usr/include/c++/14/string_view:50,
from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()'
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]'
83 | __hash_enum(__hash_enum&&);
| ^~~~~~~~~~~
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<int, int>; _ExtractKey = std::__detail::_Identity; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed:
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed:
1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()'
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<int, int>, std::__detail::_Identity, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()'
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<int, int>, std::__detail::_Identity, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed:
1306 | struct _Hash_code_base
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<std::pair<int, int>, std::pair<int, int>
|
s325700158
|
p04002
|
Java
|
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;
public class Main {
static final Reader in = new Reader();
static final PrintWriter out = new PrintWriter(System.out,false);
static boolean debug = false;
static void solve() {
int h = in.nextInt();
int w = in.nextInt();
int n = in.nextInt();
HashMap<Pair<Integer, Integer>,Integer> map = new HashMap<>();
int[] dx = { 0, 1, 1, 1, 0,-1,-1,-1, 0};
int[] dy = { 1, 1, 0,-1,-1,-1, 0, 1, 0};
for (int i=0; i<n; i++) {
int y = in.nextInt() - 1;
int x = in.nextInt() - 1;
for (int k=0; k<9; k++) {
int ny = y + dy[k];
int nx = x + dx[k];
if (ny <= 0 || nx <= 0 || h <= ny+1 || w <= nx+1) continue;
Pair<Integer, Integer> p = new Pair<>(ny, nx);
map.put(p, map.getOrDefault(p, 0) + 1);
}
}
long[] cnt = new long[10];
for (Pair<Integer, Integer> p : map.keySet()) {
cnt[map.get(p)]++;
}
long sum = 0;
for (int i=1; i<10; i++) {
sum += cnt[i];
}
out.println((long)(h-2)*(w-2) - sum);
for (int i=1; i<10; i++) {
out.println(cnt[i]);
}
}
public static void main(String[] args) throws Exception {
debug = args.length > 0;
long start = System.nanoTime();
solve();
out.flush();
long end = System.nanoTime();
dump((end - start) / 1000000 + " ms");
in.close();
out.close();
}
static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}
class Reader {
private final InputStream in;
private final byte[] buf = new byte[1024];
private int ptr = 0;
private int buflen = 0;
public Reader() { this(System.in);}
public Reader(InputStream source) { this.in = source;}
private boolean hasNextByte() {
if (ptr < buflen) return true;
ptr = 0;
try{
buflen = in.read(buf);
}catch (IOException e) {e.printStackTrace();}
if (buflen <= 0) return false;
return true;
}
private int readByte() { if (hasNextByte()) return buf[ptr++]; else return -1;}
private boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
private void skip() { while(hasNextByte() && !isPrintableChar(buf[ptr])) ptr++;}
public boolean hasNext() {skip(); return hasNextByte();}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) throw new NoSuchElementException();
boolean minus = false;
long num = readByte();
if(num == '-'){
num = 0;
minus = true;
}else if (num < '0' || '9' < num){
throw new NumberFormatException();
}else{
num -= '0';
}
while(true){
int b = readByte();
if('0' <= b && b <= '9')
num = num * 10 + (b - '0');
else if(b == -1 || !isPrintableChar(b))
return minus ? -num : num;
else
throw new NoSuchElementException();
}
}
public int nextInt() {
long num = nextLong();
if (num < Integer.MIN_VALUE || Integer.MAX_VALUE < num)
throw new NumberFormatException();
return (int)num;
}
public double nextDouble() {
return Double.parseDouble(next());
}
public char nextChar() {
if (!hasNext()) throw new NoSuchElementException();
return (char)readByte();
}
public String nextLine() {
while (hasNextByte() && (buf[ptr] == '\n' || buf[ptr] == '\r')) ptr++;
if (!hasNextByte()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (b != '\n' && b != '\r' && b != -1) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public int[] nextIntArray(int n) {
int[] res = new int[n];
for (int i=0; i<n; i++) res[i] = nextInt();
return res;
}
public char[] nextCharArray(int n) {
char[] res = new char[n];
for (int i=0; i<n; i++) res[i] = nextChar();
return res;
}
public void close() {try{ in.close();}catch(IOException e){ e.printStackTrace();}};
}
|
Main.java:16: error: cannot find symbol
HashMap<Pair<Integer, Integer>,Integer> map = new HashMap<>();
^
symbol: class Pair
location: class Main
Main.java:28: error: cannot find symbol
Pair<Integer, Integer> p = new Pair<>(ny, nx);
^
symbol: class Pair
location: class Main
Main.java:28: error: cannot find symbol
Pair<Integer, Integer> p = new Pair<>(ny, nx);
^
symbol: class Pair
location: class Main
Main.java:35: error: cannot find symbol
for (Pair<Integer, Integer> p : map.keySet()) {
^
symbol: class Pair
location: class Main
4 errors
|
s337273572
|
p04002
|
C++
|
10 10 20
1 1
1 4
1 9
2 5
3 10
4 2
4 7
5 9
6 4
6 6
6 7
7 1
7 3
7 7
8 1
8 5
8 10
9 2
10 4
10 9
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 10 10 20
| ^~
|
s268473507
|
p04002
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long ull;
ull res[10] = {};
vector<ull> c;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ull H, W, N;
cin >> H >> W >> N;
ull tot = (H-2)*(W-2);
if(N==0){
cout << tot << endl;
for(int i=1; i<10; i++) cout << 0 << endl;
return 0;
}
int a, b;
for(int i=0; i<N; i++){
cin >> a >> b;
a--; b--;
for(int j=0; j<3; j++){
if(a-j < 0 || a-j >= H-2) continue;
for(int k=0; k<3; k++){
if(b-k < 0 || b-k >= W-2) continue;
c.push_back( (a-j)*W + (b-k) );
}
}
}
sort(c.begin(), c.end());
int dif = 1;
int num = 0;
ull prev = c[0];
for(int i=0; i<c.size(); i++){
if(c[i]==prev){
num++;
if(i==c.size()-1) res[num]++;
}else{
prev=c[i];
res[num]++;
num = 1;
dif++;
}
}
cout << tot - dif << endl;
for(int i=1; i<10; i++){
cout << res[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:34:5: error: 'sort' was not declared in this scope; did you mean 'short'?
34 | sort(c.begin(), c.end());
| ^~~~
| short
|
s329429802
|
p04002
|
C++
|
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#define INT long long int
#define MOD 1000000007
using namespace std;
INT h, w, n, all, sum, ans[10];
map<pair<int, int>, int> check;
int main()
{
cin>>h>>w>>n;
while( n-- )
{
int x, y;
scanf("%d%d", &x, &y);f
for(int i = -2 ; i <= 0 ; i++ )
for(int j = -2 ; j <= 0 ; j++)
if( 1 <= x+i&&x+i <= h-2 &&
1 <= y+j&&y+j <= w-2 )
check[make_pair(x+i,y+j)]++;
}
for(map<pair<int,int>,int>::iterator i = check.begin() ; i != check.end() ; i++ )
ans[i->second]++;
ans[0] = (w-2)*(h-2);
for(int i = 1 ; i <= 9 ; i++ ) ans[0] -= ans[i];
for(int i = 0 ; i <= 9 ; i++ )
printf("%lld\n", ans[i]);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:31: error: 'f' was not declared in this scope
19 | scanf("%d%d", &x, &y);f
| ^
a.cc:20:26: error: 'i' was not declared in this scope
20 | for(int i = -2 ; i <= 0 ; i++ )
| ^
a.cc:21:30: error: 'j' was not declared in this scope
21 | for(int j = -2 ; j <= 0 ; j++)
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.