submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s492520157
|
p03967
|
C++
|
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif // !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp> // https://boostjp.github.io/tips/math.html
#include <boost/dynamic_bitset.hpp> // https://boostjp.github.io/tips/dynamic_bitset.html
constexpr int64_t DIV1097 = 1000000007LL;
using namespace std;
int main()
{
std::string S;
std::cin >> S;
int64_t ans = 0;
for (size_t i = 0; i < S.size(); ++i) {
if (S[i] == 'g') {
ans++;
}
else {
ans--;
}
}
std::cout << ans / 2 << std::endl;
return 0;
}
|
a.cc:22:10: fatal error: boost/lexical_cast.hpp: No such file or directory
22 | #include <boost/lexical_cast.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s530391555
|
p03967
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
int p = 0;
for (int i = 0; i < s.length;i++) {
char c = s.at(i);
if (c == 'p') {
p++;
}
}
cout << (s.length - p)/2;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
12 | for (int i = 0; i < s.length;i++) {
| ~~^~~~~~
| ()
a.cc:18:20: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
18 | cout << (s.length - p)/2;
| ~~^~~~~~
| ()
|
s976605889
|
p03967
|
C++
|
#include <bits/std++.h>
using namespace std;
int main(int argc, char const *argv[])
{
string s;
int p = 0;
cin >> s;
for (int i = 0; i < s.length(); i++)
{
if (s[i] == 'g')
{
}
else
{
p++;
}
cout<<s.length()/2-p;
}
return 0;
}
|
a.cc:1:10: fatal error: bits/std++.h: No such file or directory
1 | #include <bits/std++.h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s795219775
|
p03967
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int main(){
string s;
cin >> s;
int n = s.size();
int maxp = n/2;
int P = 0;
for(int i = 0; i < n; i++){
if(s[i] == 'p'){p++;}
}
cout << maxp - p << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:13:25: error: 'p' was not declared in this scope
13 | if(s[i] == 'p'){p++;}
| ^
a.cc:15:20: error: 'p' was not declared in this scope
15 | cout << maxp - p << endl;
| ^
|
s042085982
|
p03967
|
C++
|
#include <stdio.h>
#include <string.h>
#define FOR(i, a, b) for(i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define N 100000
int result(char atc, char topc){
if(atc == 'p' && topc == 'g'){
return 1;
}else if(atc == 'g' && topc == 'p'){
return -1;
}else{
return 0;
}
}
int max(int a, int b){
return a > b? a : b;
}
int rock_paper(unsigned int n, unsigned int p, unsigned int len, int dp[len + 1][len + 1], char S[N]){
if(dp[n][p] != -N){
return dp[n][p];
}
if(n == len){
return dp[n][p] = 0;
}
int rock = rock_paper(n + 1, p + 1, len, dp, S) + result('g', S[n]);
if(p == 0){
return dp[n][p] = rock;
}else{
int paper = rock_paper(n + 1, p - 1, len, dp, S) + result('p', S[n]);
return dp[n][p] = max(rock, paper);
}
}
int main(){
char S[N];
scanf("%s", S);
unsigned int len = strlen(S);
int dp[len + 1][len + 1];
unsigned int i, j;
if(len == 1){
if(S[0] == 'p'){
printf("-1\n");
}else{
printf("0\n");
}
}
else{
REP(i, len + 1){
REP(j, len + 1){
dp[i][j] = -N;
}
}
printf("%d\n", rock_paper(0, 0, len, dp, S));
/*
REP(i, len + 1){
REP(j, len + 1){
printf("%d ", dp[i][j]);
}
printf("\n");
}
*/
}
return 0;
}
/*
nターン目以降を最適化した時の最大化された点数:dp[n][p]
n:何ターン目か, p:パーを出せる回数の上限
*/
|
a.cc:22:77: error: use of parameter outside function body before '+' token
22 | int rock_paper(unsigned int n, unsigned int p, unsigned int len, int dp[len + 1][len + 1], char S[N]){
| ^
a.cc:22:86: error: use of parameter outside function body before '+' token
22 | int rock_paper(unsigned int n, unsigned int p, unsigned int len, int dp[len + 1][len + 1], char S[N]){
| ^
a.cc:22:90: error: expected ')' before ',' token
22 | int rock_paper(unsigned int n, unsigned int p, unsigned int len, int dp[len + 1][len + 1], char S[N]){
| ~ ^
| )
a.cc:22:92: error: expected unqualified-id before 'char'
22 | int rock_paper(unsigned int n, unsigned int p, unsigned int len, int dp[len + 1][len + 1], char S[N]){
| ^~~~
|
s379051605
|
p03967
|
C++
|
ggppgggpgg
|
a.cc:1:1: error: 'ggppgggpgg' does not name a type
1 | ggppgggpgg
| ^~~~~~~~~~
|
s747660394
|
p03967
|
C++
|
#include<cstdio>
#include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
const int big=(1<<30);
int gcd(int a,int b){if(a<b){swap(a,b);}if(b==0){return a;}return gcd(a%b,b);}
int main(void){
string ans,nyu;
cin>>nyu;
for(i=0;i<nyu.size()+1/2;i++){
printf("g");
}
for(i=0;i<nyu.size()/2;i++){
printf("p");
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:13: error: 'i' was not declared in this scope
11 | for(i=0;i<nyu.size()+1/2;i++){
| ^
a.cc:14:13: error: 'i' was not declared in this scope
14 | for(i=0;i<nyu.size()/2;i++){
| ^
|
s913753172
|
p03967
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#define int long long
#define MOD7 1000000007
#define MOD9 1000000009
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
using namespace std;
int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}
void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}
int cnt[2];
signed main() {
string S;
cin >> S;
rep(i, S.size()) {
if (S[i] == 'p') {
cnt[0]++;
} else {
cnt[1]++;
}
}
cout << (cnt[1] - cnt[0]) / 2 << endl:
return 0;
}
|
a.cc: In function 'int main()':
a.cc:49:42: error: expected ';' before ':' token
49 | cout << (cnt[1] - cnt[0]) / 2 << endl:
| ^
| ;
|
s211405157
|
p03967
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int g_cnt=0;
string str;
cin>>str;
for(int i=0; i<str.length(); i++){
if(str[i]=='g')cnt++;
}
cout<<g_cnt-ceil((str.length())/2.0)<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:10:24: error: 'cnt' was not declared in this scope; did you mean 'int'?
10 | if(str[i]=='g')cnt++;
| ^~~
| int
|
s121284845
|
p03967
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define X first
#define Y second
#define clr(u,v); memset(u,v,sizeof(u));
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e5+10;
const int INF=0x3f3f3f3f;
char str[maxn];
int main()
{
int g=0,p=0;
gets(str);
int len=strlen(str);
for (int i=0;i<len;i++)
if (str[i]=='g') g++;
else p++;
int P=len/2;
int G=len-P;
// printf("%d %d\n",P,p);
// printf("%d %d\n",G,g);
if (p>=P) {
p-=P;
P=0;
}
else {
P-=p;
p=0;
}
if (g>=G) {
g-=G;
G=0;
}
else {
G-=g;
g=0;
}
// printf("%d %d\n",P,p);
// printf("%d %d\n",G,g);
printf("%d\n",P-p);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
24 | gets(str);
| ^~~~
| getw
|
s537008151
|
p03967
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int main() {
int g = 0, p = 0, ans = 0, pos = 0;
string s;
cin >> s; reverse(s.begin(), s.end());
for (int i=0; i<s.length(); i++) {
if (s[i] == 'g') g++;
else p++;
}
while (p < g - 1) {
if (s[pos++] == 'g') {
g--; p++;
ans++;
}
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:19: error: 'reverse' was not declared in this scope
8 | cin >> s; reverse(s.begin(), s.end());
| ^~~~~~~
|
s433270294
|
p03967
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
string sT;
cin>>sT;
int n=sT.length();
char *sA = new char[n+1];
memset(sA,'g',n);
sA[n]='\0';
int pMax = n/2;
int pN=0;
int i=0;
for (i=0;i<n;i++){
if (sT[i]=='g'){
if (pN<pMax){
sA[i]='p';
pN++;
}else{
break;
}
}
}
int sAN=0;
for (i=0;i<n;i++){
if (sA[i]=='p' && sT[i]=='p'){
}
if (sA[i]=='g' && sT[i]=='g'){
}
if (sA[i]=='p' && sT[i]=='g'){
sAN++;
}
if (sA[i]=='g' && sT[i]=='p'){
sAN--;
}
}
cout<<sAN<<endl;
return 0;
}
|
a.cc: In function 'int main(int, char**)':
a.cc:10:9: error: 'memset' was not declared in this scope
10 | memset(sA,'g',n);
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
|
s615081226
|
p03967
|
Java
|
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] c = sc.next().toCharArray();
int n = c.length;
int score = 0;
int p = 0;
for(int i=0; i<n; i++){
if(p>0){
if(c[i] == 'g'){
score++;
p--;
}else{
p--;
}
}else{
if(c[i] == 'g'){
p++;
}else{
p++;
score--;
}
}
}
System.out.println(score);
}
}
|
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s734488120
|
p03967
|
C++
|
#include <vector>
#include <map>
#include <array>
#include <iterator>
#include <cstdio>
#include <functional>
template<typename T> struct ScanfSpecifier{};
#define DEF(T,V) template<> struct ScanfSpecifier<T>{static constexpr const char* value = V;};
DEF(char*,"%s")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));}
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;
};
}
//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 s[100009];
int f(char c) { return c == 'g'? 1: -1; }
int main()
{
RD(s);
int N = strlen(s);
int now = 0;
for(int i = 0; i < N; i++)
now += f(s[i]);
WTL(now / 2);
}
|
a.cc: In function 'int main()':
a.cc:107:13: error: 'strlen' was not declared in this scope
107 | int N = strlen(s);
| ^~~~~~
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>
|
s095778202
|
p03968
|
C++
|
#include<bits/stdc++/h>
using namespace std;
const int N=1000;
unordered_map<ll,int>mp;
struct node{
int c[4];
node nxt(){ return node{c[1],c[2],c[3],c[0]};}
}a[N];
void add(node x,int d){
for (int j=1;j<=4;++j,x=x.nxt())
mp[x]+=d;
}
int main(){
scanf("%d",&n);
for (int i=1;i<=n;++i){
scanf("%d%d%d%d",&a[i].c[0],&a[i].c[1],&a[i].c[2],&a[i].c[3]);
add(a[i],1);
}
for (int i=1;i<n;++i){
add(a[i],-1);
for (int j=i+1;j<=n;++j){
add(a[j],-1);
for (int k=0;k<4;++k){
m1=node{a[j].c[1],a[i].c[0],a[i].c[3],a[j].c[2]};
m2=node{a[i].c[1],a[j].c[0],a[j].c[3],a[i].c[2]};
m3=node{a[j].c[1],a[j].c[0],a[i].c[1],a[i].c[0]};
m4=node{a[i].c[3],a[i].c[2],a[j].c[3],a[j].c[2]};
a[j]=a[j].nxt();
if (mp[a1]==0||mp[a2]==0||mp[a3]==0||mp[a4]==0) continue;
re=1;
re*=mp[a1];insert(a1,-1);
re*=mp[a2];insert(a2,-1);
re*=mp[a3];insert(a3,-1);
re*=mp[a4];
insert(a1,1);insert(a2,1);insert(a3,1);
ans+=re;
}
insert(a[j],1);
}
}
printf("%d\n",ans);
}
|
a.cc:1:9: fatal error: bits/stdc++/h: No such file or directory
1 | #include<bits/stdc++/h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s029758564
|
p03968
|
C++
|
解けてるはず
|
a.cc:1:1: error: '\U000089e3\U00003051\U00003066\U0000308b\U0000306f\U0000305a' does not name a type
1 | 解けてるはず
| ^~~~~~~~~~~~
|
s257353455
|
p03968
|
C++
|
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T,typename U, typename H=hash<T> >
using gmap = cc_hash_table<T, U, H>;
//INSERT ABOVE HERE
const int MAX = 404;
int cs[4][MAX];
using A = array<int, 8>;
A rotH(A x){
A y;
y[0]=x[1];
y[1]=x[2];
y[2]=x[3];
y[3]=x[0];
y[7]=x[6];
y[6]=x[5];
y[5]=x[4];
y[4]=x[7];
return y;
}
A rotN(A x){
A y;
y[0]=x[3];
y[3]=x[4];
y[4]=x[7];
y[7]=x[0];
y[1]=x[2];
y[2]=x[5];
y[5]=x[6];
y[6]=x[1];
return y;
}
using ll = long long;
ll make_hash(ll a,ll b,ll c,ll d){
return (a<<30)|(b<<20)|(c<<10)|d;
}
using P = pair<ll, ll>;
P make_hash(A x){
return P(make_hash(x[0],x[1],x[2],x[3]),
make_hash(x[4],x[5],x[6],x[7]));
}
gmap<ll, int> cnt,idx;
ll hs[4][MAX]={};
void inc(ll v){
int k=idx[v];
cnt[hs[0][k]]++;
cnt[hs[1][k]]++;
cnt[hs[2][k]]++;
cnt[hs[3][k]]++;
}
void dec(ll v){
int k=idx[v];
cnt[hs[0][k]]--;
cnt[hs[1][k]]--;
cnt[hs[2][k]]--;
cnt[hs[3][k]]--;
}
__int128_t check(A x){
ll a=make_hash(x[0],x[1],x[2],x[3]);
ll b=make_hash(x[4],x[5],x[6],x[7]);
ll c=make_hash(x[3],x[2],x[5],x[4]);
ll d=make_hash(x[2],x[1],x[6],x[5]);
ll e=make_hash(x[1],x[0],x[7],x[6]);
ll f=make_hash(x[0],x[3],x[4],x[7]);
if(!cnt.count(a)) return 0;
if(!cnt.count(b)) return 0;
if(!cnt.count(c)) return 0;
if(!cnt.count(d)) return 0;
if(!cnt.count(e)) return 0;
if(!cnt.count(f)) return 0;
__int128_t res=1;
res*=cnt[a];dec(a);
res*=cnt[b];dec(b);
res*=cnt[c];dec(c);
res*=cnt[d];dec(d);
res*=cnt[e];dec(e);
res*=cnt[f];dec(f);
inc(a);
inc(b);
inc(c);
inc(d);
inc(e);
inc(f);
return res;
}
signed main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>cs[0][i]>>cs[1][i]>>cs[2][i]>>cs[3][i];
for(int z=0;z<4;z++){
hs[z][i]=make_hash(cs[(z+0)%4][i],
cs[(z+1)%4][i],
cs[(z+2)%4][i],
cs[(z+3)%4][i]);
cnt[hs[z][i]]++;
idx[hs[z][i]]=i;
}
}
ll ans=0;
set<P> used;
vector<A> vs;
{
A w;
set<A> rs;
for(int i=0;i<8;i++) w[i]=i;
for(int p=0;p<4;p++){
for(int q=0;q<4;q++){
for(int r=0;r<4;r++){
rs.emplace(w);
w=rotH(w);
}
w=rotN(w);
}
w=rotH(w);
}
vs=vector<A>(rs.begin(),rs.end());
}
for(int i=0;i<n;i++){
for(int j=0;j<i;j++){
for(int z=0;z<4;z++){
A x;
for(int k=0;k<4;k++){
x[k+0]=cs[(k+z)%4][i];
x[k+4]=cs[k][j];
}
int way=0;
A w(x);
for(auto v:vs){
A y;
for(int k=0;k<8;k++) y[k]=x[v[k]];
if(x==y) way++;
chmin(w,y);
}
if(used.count(make_hash(w))) continue;
used.emplace(make_hash(w));
ans+=check(x)/way;
}
}
}
cout<<ans<<endl;
return 0;
}
|
a.cc: In function '__int128 check(A)':
a.cc:85:11: error: 'gmap<long long int, int>' {aka 'class __gnu_pbds::cc_hash_table<long long int, int, std::hash<long long int>, std::equal_to<long long int>, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>, false, std::allocator<char> >'} has no member named 'count'
85 | if(!cnt.count(a)) return 0;
| ^~~~~
a.cc:86:11: error: 'gmap<long long int, int>' {aka 'class __gnu_pbds::cc_hash_table<long long int, int, std::hash<long long int>, std::equal_to<long long int>, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>, false, std::allocator<char> >'} has no member named 'count'
86 | if(!cnt.count(b)) return 0;
| ^~~~~
a.cc:87:11: error: 'gmap<long long int, int>' {aka 'class __gnu_pbds::cc_hash_table<long long int, int, std::hash<long long int>, std::equal_to<long long int>, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>, false, std::allocator<char> >'} has no member named 'count'
87 | if(!cnt.count(c)) return 0;
| ^~~~~
a.cc:88:11: error: 'gmap<long long int, int>' {aka 'class __gnu_pbds::cc_hash_table<long long int, int, std::hash<long long int>, std::equal_to<long long int>, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>, false, std::allocator<char> >'} has no member named 'count'
88 | if(!cnt.count(d)) return 0;
| ^~~~~
a.cc:89:11: error: 'gmap<long long int, int>' {aka 'class __gnu_pbds::cc_hash_table<long long int, int, std::hash<long long int>, std::equal_to<long long int>, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>, false, std::allocator<char> >'} has no member named 'count'
89 | if(!cnt.count(e)) return 0;
| ^~~~~
a.cc:90:11: error: 'gmap<long long int, int>' {aka 'class __gnu_pbds::cc_hash_table<long long int, int, std::hash<long long int>, std::equal_to<long long int>, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>, false, std::allocator<char> >'} has no member named 'count'
90 | if(!cnt.count(f)) return 0;
| ^~~~~
|
s073802335
|
p03968
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 400;
map<LL,LL> occ;
LL arr[N + 5][4];
LL f[N + 5];
LL tmp[4];
void shifting(LL x, int add) { //rotate
for(int i = 0;i < 4;i++) {
occ[x] += add;
x = ((x >> 10) | ((x & 1023) << 30));
}
}
LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
return (a << 30LL) | (b << 20LL) | (c << 10LL) | d;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
for(int i = 0;i < n;i++) {
for(int j = 0;j < 4;j++) cin>>arr[i][j];
f[i] = hash(arr[i][0], arr[i][1], arr[i][2], arr[i][3]);
shifting(f[i], 1);
}
LL tot = 0;
for(int i = 0;i < n;i++) {
shifting(f[i], -1); //fixing front side
for(int j = i + 1;j < n;j++) {
shifting(f[j], -1); //fixing back side
for(int k = 0;k < 4;k++) {
tmp[0] = hash(arr[i][3], arr[i][2], arr[j][(1 + k) % 4], arr[j][k % 4]);
tmp[1] = hash(arr[i][2], arr[i][1], arr[j][(2 + k) % 4], arr[j][(k + 1) % 4]);
tmp[2] = hash(arr[i][1], arr[i][0], arr[j][(3 + k) % 4], arr[j][(k + 2) % 4]);
tmp[3] = hash(arr[i][0], arr[i][3], arr[j][(k) % 4], arr[j][(k + 3) % 4]);
LL res = 1;
for(int i = 0;i < 4;i++) {
res *= occ[tmp[i]];
shifting(tmp[i], -1);
}
tot += res;
for(int i = 0;i < 4;i++) shifting(tmp[i], 1);
}
shifting(f[j], 1);
}
}
cout<<tot<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:32:24: error: reference to 'hash' is ambiguous
32 | f[i] = hash(arr[i][0], arr[i][1], arr[i][2], arr[i][3]);
| ^~~~
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,
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:19:4: note: 'LL hash(LL, LL, LL, LL)'
19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
| ^~~~
a.cc:41:42: error: reference to 'hash' is ambiguous
41 | tmp[0] = hash(arr[i][3], arr[i][2], arr[j][(1 + k) % 4], arr[j][k % 4]);
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:19:4: note: 'LL hash(LL, LL, LL, LL)'
19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
| ^~~~
a.cc:42:42: error: reference to 'hash' is ambiguous
42 | tmp[1] = hash(arr[i][2], arr[i][1], arr[j][(2 + k) % 4], arr[j][(k + 1) % 4]);
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:19:4: note: 'LL hash(LL, LL, LL, LL)'
19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
| ^~~~
a.cc:43:42: error: reference to 'hash' is ambiguous
43 | tmp[2] = hash(arr[i][1], arr[i][0], arr[j][(3 + k) % 4], arr[j][(k + 2) % 4]);
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:19:4: note: 'LL hash(LL, LL, LL, LL)'
19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
| ^~~~
a.cc:44:42: error: reference to 'hash' is ambiguous
44 | tmp[3] = hash(arr[i][0], arr[i][3], arr[j][(k) % 4], arr[j][(k + 3) % 4]);
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:19:4: note: 'LL hash(LL, LL, LL, LL)'
19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
| ^~~~
|
s051050113
|
p03968
|
C++
|
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// #include<deque>
// #include<multiset>
// #include<bitset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;
int n;
using Panel = array<int, 4>;
Panel rotate(Panel a) {
tie(a[0], a[1], a[2], a[3]) = make_tuple(a[1], a[2], a[3], a[0]);
return a;
}
Panel normalize(Panel a) {
Panel p[4];
for(int i = 0; i < 4; i++) {
p[i] = a;
a = rotate(a);
}
return *min_element(p, p + 4);
}
const int N = 400;
int rotcount(Panel a) {
auto b = a;
int res = 0;
for(int i = 0; i < 4; i++) {
b = rotate(b);
if(a == b) res++;
}
return res;
}
ll fact[10];
ll comb[N + 1][N + 1];
Panel a[N];
int main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> n;
for(int i = 0; i < n; i++) {
cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
a[i] = normalize(a[i]);
}
comb[0][0] = 1;
for(int i = 1; i <= n; i++) for(int j = 0; j <= n; j++) {
// Pascal's identity
if(j == 0) {
comb[i][j] = 1;
continue;
}
comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
}
fact[0] = 1;
for(int i = 1; i <= 9; i++) fact[i] = fact[i-1] * i;
ll ans = 0;
for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++) {
dump(i, j);
for(int rot = 0; rot < 4; rot++) {
a[i] = rotate(a[i]);
map<Panel, int> target;
map<Panel, int> cnt;
for(int k = 0; k < 4; k++) {
Panel f{a[i][(k + 1) % 4], a[i][k + 0], a[j][(4 - k) % 4], a[j][(3 - k) % 4]};
f = normalize(f);
target[f]++;
cnt[f] = 0;
}
for(int l = 0; l < n; l++) {
if(l == i) continue;
if(l == j) continue;
if(target.count(a[l])) cnt[a[l]]++;
}
dump(target);
dump(cnt);
int ng = 0;
ll res = 1;
for(auto &p : target) {
Panel pan;
int tar;
tie(pan, tar) = p;
if(cnt[pan] < tar) {ng = 1; break;}
res *= comb[cnt[pan]][tar] * pow((ll) rotcount(pan), (ll) tar) * fact[tar];
}
if(ng) continue;
ans += res;
}
}
assert(ans % 3 == 0);
cout << ans/3 << endl;
return 0;
}
|
a.cc:26:20: error: 'a' has incomplete type
26 | Panel rotate(Panel a) {
| ~~~~~~^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: declaration of 'using Panel = struct std::array<int, 4>' {aka 'struct std::array<int, 4>'}
99 | struct array;
| ^~~~~
a.cc:26:21: error: return type 'using Panel = struct std::array<int, 4>' {aka 'struct std::array<int, 4>'} is incomplete
26 | Panel rotate(Panel a) {
| ^
a.cc:31:23: error: 'a' has incomplete type
31 | Panel normalize(Panel a) {
| ~~~~~~^
/usr/include/c++/14/bits/stl_pair.h:99:12: note: declaration of 'using Panel = struct std::array<int, 4>' {aka 'struct std::array<int, 4>'}
99 | struct array;
| ^~~~~
a.cc:31:24: error: return type 'using Panel = struct std::array<int, 4>' {aka 'struct std::array<int, 4>'} is incomplete
31 | Panel normalize(Panel a) {
| ^
a.cc: In function 'void normalize(Panel)':
a.cc:32:9: error: elements of array 'Panel p [4]' have incomplete type
32 | Panel p[4];
| ^
a.cc:32:9: error: storage size of 'p' isn't known
a.cc: At global scope:
a.cc:42:20: error: 'a' has incomplete type
42 | int rotcount(Panel a) {
| ~~~~~~^
/usr/include/c++/14/bits/stl_pair.h:99:12: note: declaration of 'using Panel = struct std::array<int, 4>' {aka 'struct std::array<int, 4>'}
99 | struct array;
| ^~~~~
a.cc:55:7: error: elements of array 'Panel a [400]' have incomplete type
55 | Panel a[N];
| ^
a.cc:55:7: error: storage size of 'a' isn't known
a.cc: In function 'int main()':
a.cc:80:5: error: 'dump' was not declared in this scope
80 | dump(i, j);
| ^~~~
a.cc:86:15: error: variable 'Panel f' has initializer but incomplete type
86 | Panel f{a[i][(k + 1) % 4], a[i][k + 0], a[j][(4 - k) % 4], a[j][(3 - k) % 4]};
| ^
/usr/include/c++/14/bits/stl_pair.h: In instantiation of 'struct std::pair<const std::array<int, 4>, int>':
a.cc:102:21: required from here
102 | for(auto &p : target) {
| ^~~~~~
/usr/include/c++/14/bits/stl_pair.h:290:11: error: 'std::pair<_T1, _T2>::first' has incomplete type
290 | _T1 first; ///< The first member
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: declaration of 'struct std::array<int, 4>'
99 | struct array;
| ^~~~~
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In instantiation of 'struct std::is_copy_assignable<const std::array<int, 4> >':
/usr/include/c++/14/type_traits:183:35: required by substitution of 'template<class ... _Bn> std::__detail::__first_t<std::integral_constant<bool, true>, typename std::enable_if<(bool)(_Bn::value), void>::type ...> std::__detail::__and_fn(int) [with _Bn = {std::is_copy_assignable<const std::array<int, 4> >, std::is_copy_assignable<int>}]'
183 | __enable_if_t<bool(_Bn::value)>...>;
| ^~~~~
/usr/include/c++/14/type_traits:199:42: required from 'struct std::__and_<std::is_copy_assignable<const std::array<int, 4> >, std::is_copy_assignable<int> >'
199 | : decltype(__detail::__and_fn<_Bn...>(0))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_pair.h:922:38: required from 'struct std::pair<const std::array<int, 4>, int>'
922 | is_copy_assignable<_T2>>::value,
| ^~~~~
a.cc:102:21: required from here
102 | for(auto &p : target) {
| ^~~~~~
/usr/include/c++/14/type_traits:1237:52: error: static assertion failed: template argument must be a complete class or an unbounded array
1237 | static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:1237:52: note: 'std::__is_complete_or_unbounded<__type_identity<const array<int, 4> > >((std::__type_identity<const std::array<int, 4> >(), std::__type_identity<const std::array<int, 4> >()))' evaluates to false
/usr/include/c++/14/type_traits: In instantiation of 'struct std::is_move_assignable<const std::array<int, 4> >':
/usr/include/c++/14/type_traits:183:35: required by substitution of 'template<class ... _Bn> std::__detail::__first_t<std::integral_constant<bool, true>, typename std::enable_if<(bool)(_Bn::value), void>::type ...> std::__detail::__and_fn(int) [with _Bn = {std::is_move_assignable<const std::array<int, 4> >, std::is_move_assignable<int>}]'
183 | __enable_if_t<bool(_Bn::value)>...>;
| ^~~~~
/usr/include/c++/14/type_traits:199:42: required from 'struct std::__and_<std::is_move_assignable<const std::array<int, 4> >, std::is_move_assignable<int> >'
199 | : decltype(__detail::__and_fn<_Bn...>(0))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_pair.h:932:38: required from 'struct std::pair<const std::array<int, 4>, int>'
932 | is_move_assignable<_T2>>::value,
| ^~~~~
a.cc:102:21: required from here
102 | for(auto &p : target) {
| ^~~~~~
/usr/include/c++/14/type_traits:1246:52: error: static assertion failed: template argument must be a complete class or an unbounded array
1246 | static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:1246:52: note: 'std::__is_complete_or_unbounded<__type_identity<const array<int, 4> > >((std::__type_identity<const std::array<int, 4> >(), std::__type_identity<const std::array<int, 4> >()))' evaluates to false
a.cc:103:15: error: aggregate 'Panel pan' has incomplete type and cannot be defined
103 | Panel pan;
| ^~~
|
s916877229
|
p03968
|
C++
|
#include<bits\stdc++.h>
using namespace std;
#define ll long long
#define lf double
#define N 4
#define err {puts("-1");exit(0);};
int color[408][4];
ll has(int a[])
{
ll res=0;
for(int i=N-1;i>=0;i--) res=res*1000+a[i];
return res;
}
vector<ll> _rotate(int c[])
{
vector<ll> res;
// for(int i=0;i<N;i++) cout<<c[i]<<" ";
for(int i=0;i<N;i++)
{
int a[4];
for(int j=0;j<N;j++) a[j]=c[(i+j)%N];
res.push_back(has(a));
}return res;
}
int same(ll x,ll y)
{
int a[N],c[N];int sum=0;
for(int i=0;i<N;i++) a[i]=x%1000,x/=1000;
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++) c[j]=a[(i+j)%N];
sum+= has(c)==y;
}return sum;
}
map<ll,ll >m;
void ins(int x)
{
vector<ll> v=_rotate(color[x]);
for(int i=0;i<v.size();i++) m[v[i]]++;
}
ll ans;
ll operate(int c1[],int c2[])
{
// for(int i=0;i<N;i++) cout<<c1[i]<<" ";cout<<"\n";
// for(int i=0;i<N;i++) cout<<c2[i]<<" ";cout<<"\n";system("pause");
ll p=has(c1);
int a[4];ll ck[4];
for(int i=0;i<N;i++)
{
a[0]=c1[i],a[1]=c1[(i+1)%N],a[2]=c2[(i+1)%N],a[3]=c2[i];
ck[i]=has(a);
}
ll cnt=1;
for(int i=0;i<4;i++)
{
ll over=same(p,ck[i]);
for(int j=0;j<i;j++) over+=same(ck[j],ck[i]);
if(m[ck[i]]<=0) return 0;
cnt*=m[ck[i]]-over;
}
return cnt;
}
int bel[]={0,3,2,1};
int main()
{
int n;cin>>n;
for(int i=1;i<=n;i++) for(int j=0;j<N;j++) cin>>color[i][j];
for(int i=n;i>=1;i--)
{
for(int j=i+1;j<=n;j++)
{
int a[N],b[N];for(int k=0;k<N;k++) b[k]=color[i][k];
for(int k=0;k<N;k++)
{
for(int l=0;l<N;l++)
a[l]=color[j][bel[(l+k)%N]];
ans+=operate(a,b);
}
}ins(i);
}
cout<<ans;
return 0;
}
/*
3
2 6 3
4
1 1 2 2
1 1 3 3
2 1 9
1 1 3 2
*/
/*
5
1 2 3 4 5
6
1 1 4 2
2 3 6
1 1 4 2
1 1 5 2
2 5 10
1 1 5 2
*/
|
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s057089937
|
p03968
|
C++
|
#include<bits\stdc++.h>
using namespace std;
#define ll long long
#define lf double
#define N 4
#define err {puts("-1");exit(0);};
int color[408][4];
ll has(int a[])
{
ll res=0;
for(int i=N-1;i>=0;i--) res=res*1000+a[i];
return res;
}
vector<ll> _rotate(int c[])
{
vector<ll> res;
// for(int i=0;i<N;i++) cout<<c[i]<<" ";
for(int i=0;i<N;i++)
{
int a[4];
for(int j=0;j<N;j++) a[j]=c[(i+j)%N];
res.push_back(has(a));
}return res;
}
int same(ll x,ll y)
{
int a[N],c[N];int sum=0;
for(int i=0;i<N;i++) a[i]=x%1000,x/=1000;
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++) c[j]=a[(i+j)%N];
sum+= has(c)==y;
}return sum;
}
map<ll,ll >m;
void ins(int x)
{
vector<ll> v=_rotate(color[x]);
for(int i=0;i<v.size();i++) m[v[i]]++;
}
ll ans;
ll operate(int c1[],int c2[])
{
// for(int i=0;i<N;i++) cout<<c1[i]<<" ";cout<<"\n";
// for(int i=0;i<N;i++) cout<<c2[i]<<" ";cout<<"\n";system("pause");
ll p=has(c1);
int a[4];ll ck[4];
for(int i=0;i<N;i++)
{
a[0]=c1[i],a[1]=c1[(i+1)%N],a[2]=c2[(i+1)%N],a[3]=c2[i];
ck[i]=has(a);
}
ll cnt=1;
for(int i=0;i<4;i++)
{
ll over=same(p,ck[i]);
for(int j=0;j<i;j++) over+=same(ck[j],ck[i]);
if(m[ck[i]]<=0) return 0;
cnt*=m[ck[i]]-over;
}
return cnt;
}
int bel[]={0,3,2,1};
int main()
{
int n;cin>>n;
for(int i=1;i<=n;i++) for(int j=0;j<N;j++) cin>>color[i][j];
for(int i=n;i>=1;i--)
{
for(int j=i+1;j<=n;j++)
{
int a[N],b[N];for(int k=0;k<N;k++) b[k]=color[i][k];
for(int k=0;k<N;k++)
{
for(int l=0;l<N;l++)
a[l]=color[j][bel[(l+k)%N]];
ans+=operate(a,b);
}
}ins(i);
}
cout<<ans;
return 0;
}
/*
3
2 6 3
4
1 1 2 2
1 1 3 3
2 1 9
1 1 3 2
*/
/*
5
1 2 3 4 5
6
1 1 4 2
2 3 6
1 1 4 2
1 1 5 2
2 5 10
1 1 5 2
*/
|
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s321406159
|
p03968
|
C++
|
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<set>
#include<iomanip>
#include<map>
#define sqr(x)(x)*(x)
#define fz1(i,n) for (i=1;i<=n;i++)
#define fd1(i,n) for (i=n;i>=1;i--)
#define fz0g(i,n) for (i=0;i<=n;i++)
#define fd0g(i,n) for (i=n;i>=0;i--)
#define fz0k(i,n) for (i=0;i<n;i++)
#define fd0k(i,n) for (i=(long long)(n-1);i>=0;i--)
#define fz(i,x,y) for (i=x;i<=y;i++)
#define fd(i,y,x) for (i=y;i>=x;i--)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){char ss[len];scanf("%s",ss);(st)=ss;}
using namespace std;
//struct bit{T_ arr[1000005];int lowbit(int x){return x&(-x);}void add(int x,T_ y){for (int i=x;i<=n;i+=lowbit(i)) arr[i]+=y;}T_ query(int x){T_ s=0;for (int i=x;i>0;i-=lowbit(i)) s+=arr[i];return s;}};
//struct seg{struct treedot{int l,r;T_ sum,add;void update(T_ x){sum+=(r-l+1)*x; add+=x;}}c[800005];void pushdown(int id){if (c[id].add){c[id*2].update(c[id].add);c[id*2+1].update(c[id].add);c[id].add=0;}}void pushup(int id){c[id].sum=c[id*2].sum+c[id*2+1].sum;}void build(int id,int l,int r){if (l>r) return;c[id].l=l;c[id].r=r;c[id].sum=0;c[id].add=0;if (l==r) c[id].sum=0;else{int mid=l+(r-l)/2;build(id*2,l,mid);build(id*2+1,mid+1,r);pushup(id);}}void update(int id,int le,int ri,T_ x){if (le>c[id].r||ri<c[id].l) return;if (le<=c[id].l&&c[id].r<=ri) c[id].update(x);else{pushdown(id);update(id*2,le,ri,x);update(id*2+1,le,ri,x);pushup(id);}}T_ query(int id,int le,int ri){if (ri<c[id].l||c[id].r<le) return 0;if (le<=c[id].l&&c[id].r<=ri) return c[id].sum;T_ ans=0;pushdown(id);ans+=query(id*2,le,ri);ans+=query(id*2+1,le,ri);pushup(id);return ans;}};
long long n,m,i,j,k,l,ans,a[405][6];
map<pair<pair<long long,long long>,pair<long long,long long> >,long long> mp;
void mve(long long &w,long long &x,long long &y,long long &z)
{
long long t=z;
z=y;y=x;x=w;w=t;
}
void add(long long w,long long x,long long y,long long z)
{
int i;
fz1(i,4)
{
mp[make_pair(make_pair(w,x),make_pair(y,z))]++;
mve(w,x,y,z);
}
}
void del(long long w,long long x,long long y,long long z)
{
int i;
fz1(i,4)
{
mp[make_pair(make_pair(w,x),make_pair(y,z))]--;
mve(w,x,y,z);
}
}
int main()
{
scanf("%lld",&n);
fz1(i,n)
{
fz1(j,4)
{
scanf("%lld",&a[i][j]);
}
add(a[i][1],a[i][2],a[i][3],a[i][4]);
}
fz1(i,n)
{
del(a[i][1],a[i][2],a[i][3],a[i][4]);
fz(j,i+1,n)
{
del(a[j][1],a[j][2],a[j][3],a[j][4]);
fz1(k,4)
{
mve(a[j][1],a[j][2],a[j][3],a[j][4]);
}
}
}
|
a.cc: In function 'int main()':
a.cc:73:10: error: expected '}' at end of input
73 | }
| ^
a.cc:51:1: note: to match this '{'
51 | {
| ^
|
s339690093
|
p03968
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
int n,a[405][4],tot[405];
ll h[405][4],hh[405];
map<ll,ll> f[5];
int id[4][4]={{1,0,1,0},{3,2,3,2},{2,1,0,3},{0,3,2,1}};
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)
for(int p=0;p<4;p++) scanf("%d",&a[i][p]);
for(int i=1;i<=n;i++){
ll mn=1e15;int sum=0;
for(int p=0;p<4;p++){
for(int j=0;j<4;j++){
int x=(p+j)&3;
h[i][p]=h[i][p]*1000+a[i][x];
}
if(h[i][p]<mn) mn=h[i][p],sum=0;
if(h[i][p]==mn) sum++;
}
if(f[0].find(mn)==f[0].end()){
for(int p=1;p<=4;p++) f[p][mn]=0;
f[0][mn]=1;
}
hh[i]=mn;tot[i]=sum;
for(int p=4;p;p--){
f[p][mn]+=f[p-1][mn]*sum;
}
}
ll ans=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=4;j++) f[j][hh[i]]-=f[j-1][hh[i]]*tot[i];
for(int p=i+1;p<=n;p++){
for(int j=1;j<=4;j++) f[j][hh[p]]-=f[j-1][hh[p]]*tot[p];
for(int ww=0;ww<4;ww++){
int b[4],c[4];
for(int k=0;k<4;k++) b[k]=a[p][(k+ww)&3];
ll mn[4]={1e15,1e15,1e15,1e15};
for(int j=0;j<4;j++){
for(int w=0;w<2;w++) c[w]=a[i][id[j][w]];
for(int w=2;w<4;w++) c[w]=b[id[j][w]];
for(int w=0;w<4;w++){
ll H=0;
for(int o=0;o<4;o++) H=H*1000+c[(o+w)&3];
mn[j]=min(mn[j],H);
}
}
sort(mn,mn+4);
ll sum=1;
for(int j=0;j<4;){
int o;
for(o=j;o<4&&mn[o]==mn[j];o++) sum*=(o-j+1);
if(f[o-j].find(mn[j])==f[o-j].end()){
sum=0;break;
}
sum*=f[o-j][mn[j]];
j=o;
}
ans+=sum;
}
for(int j=4;j;j--) f[j][hh[p]]+=f[j-1][hh[p]]*tot[p];
}
}
printf("%lld",ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:43:43: error: narrowing conversion of '1.0e+15' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing]
43 | ll mn[4]={1e15,1e15,1e15,1e15};
| ^~~~
a.cc:43:48: error: narrowing conversion of '1.0e+15' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing]
43 | ll mn[4]={1e15,1e15,1e15,1e15};
| ^~~~
a.cc:43:53: error: narrowing conversion of '1.0e+15' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing]
43 | ll mn[4]={1e15,1e15,1e15,1e15};
| ^~~~
a.cc:43:58: error: narrowing conversion of '1.0e+15' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing]
43 | ll mn[4]={1e15,1e15,1e15,1e15};
| ^~~~
|
s874559951
|
p03968
|
C++
|
#include <bits/stdc++.h>
#define N 500
#define int long long
using namespace std;
typedef long long ll;
inline int read()
{
int x=0,f=1; char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
int c[N][4],n,C[N][6],fac[5];
ll A[N],Ans;
map <ll,int> M;
inline int fnd(long long y)
{
int x[4];
for(int i=0;i<4;i++) x[i]=y&((1<<10)-1),y>>=10;
if(x[0]==x[1]&&x[1]==x[2]&&x[2]==x[3]) return 4;
if(x[0]==x[2]&&x[1]==x[3]) return 2;
return 1;
}
inline ll hash(int x,int y,int z,int s)
{
ll xs=(1ll*x<<30)+(1ll*y<<20)+(1ll*z<<10)+s;
return xs;
}
inline ll trans(int x,int y,int z,int s)
{
return min(min(hash(x,y,z,s),hash(y,z,s,x)),min(hash(z,s,x,y),hash(s,x,y,z)));
}
signed main()
{
n=read(); for(int i=1;i<=n;i++)
{
for(int j=0;j<4;j++) c[i][j]=read();
A[i]=trans(c[i][0],c[i][1],c[i][2],c[i][3]);
}
fac[0]=1; fac[1]=1; fac[2]=2; fac[3]=6; fac[4]=24;
C[0][0]=1; for(int i=1;i<=n;i++)
{
C[i][0]=1;for(int j=1;j<=4;j++)
C[i][j]=C[i-1][j-1]+C[i-1][j];
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<i;j++)
{
for(int k=0;k<4;k++)
{
int y[4];
y[0]=trans(c[i][(k+1)%4],c[i][(k+0)%4],c[j][1],c[j][0]);
y[1]=trans(c[i][(k+0)%4],c[i][(k+3)%4],c[j][2],c[j][1]);
y[2]=trans(c[i][(k+3)%4],c[i][(k+2)%4],c[j][3],c[j][2]);
y[3]=trans(c[i][(k+2)%4],c[i][(k+1)%4],c[j][0],c[j][3]);
sort(y,y+4); ll ret=1;
for(int p=0;p<4;p++)
{
int s=p; while(y[s]==y[p]) s++;
int tot=M[y[p]];
if(A[j]==y[p]) tot--;
if(s-p>tot) ret=0;
for(int t=1;t<=s-p;t++) ret*=fnd(y[p]);
ret*=C[tot][s-p]*fac[s-p];
p=s-1;
}
Ans+=ret;
}
}
M[A[i]]++;
//cout << A[i] << " " << M[A[i]] << endl;
}
cout << Ans << endl;
return 0;
}
|
a.cc: In function 'll trans(long long int, long long int, long long int, long long int)':
a.cc:31:24: error: reference to 'hash' is ambiguous
31 | return min(min(hash(x,y,z,s),hash(y,z,s,x)),min(hash(z,s,x,y),hash(s,x,y,z)));
| ^~~~
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,
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:24:11: note: 'll hash(long long int, long long int, long long int, long long int)'
24 | inline ll hash(int x,int y,int z,int s)
| ^~~~
a.cc:31:38: error: reference to 'hash' is ambiguous
31 | return min(min(hash(x,y,z,s),hash(y,z,s,x)),min(hash(z,s,x,y),hash(s,x,y,z)));
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:24:11: note: 'll hash(long long int, long long int, long long int, long long int)'
24 | inline ll hash(int x,int y,int z,int s)
| ^~~~
a.cc:31:57: error: reference to 'hash' is ambiguous
31 | return min(min(hash(x,y,z,s),hash(y,z,s,x)),min(hash(z,s,x,y),hash(s,x,y,z)));
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:24:11: note: 'll hash(long long int, long long int, long long int, long long int)'
24 | inline ll hash(int x,int y,int z,int s)
| ^~~~
a.cc:31:71: error: reference to 'hash' is ambiguous
31 | return min(min(hash(x,y,z,s),hash(y,z,s,x)),min(hash(z,s,x,y),hash(s,x,y,z)));
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:24:11: note: 'll hash(long long int, long long int, long long int, long long int)'
24 | inline ll hash(int x,int y,int z,int s)
| ^~~~
|
s984962051
|
p03968
|
C++
|
#include<bits/stdc++.h>
using namespace std;
vector<vector<int> >t;
multiset<vector<int> >v;
int n,c;
long long ans,cnt,tt;
vector<int> rot(vector<int> vv){return {vv[1],vv[2],vv[3],vv[0]};}
int main()
{
vector<int>t1,t2;
vector<vector<int> >::iterator it1,it2;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
t.push_back({a,b,c,d});
}
sort(t.begin(),t.end());
for(it1=t.begin();it1!=t.end();it1++)
{
for(it2=it1,it2++;it2!=t.end();it2++)
{
t1=*it1;t2=*it2;
for(int d=0;d<4;d++,t2=rot(t2))
{
v.clear();
v.insert(t1);
v.insert(t2);
cnt=1;
for(int i=0;i<4;i++)
{
tt=0;
vector<int> vv={t1[(i+1)%4],t1[i%4],t2[(4-i)%4],t2[(7-i)%4]};
for(int j=0;j<4;j++,vv=rot(vv))
{
tt+=upper_bound(t.begin(),t.end(),t)-lower_bound(t.begin(),t.end(),t);
tt-=v.count(vv);
}
tt=max(tt,0ll);
cnt*=tt;
v.insert(vv);
}
ans+=cnt;
}
}
}
printf("%lld\n",ans/3);
return 0;
}
|
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::_Val_less_iter::operator()(_Value&, _Iterator) const [with _Value = const std::vector<std::vector<int> >; _Iterator = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<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<vector<int>*, vector<vector<int> > >; _Tp = vector<vector<int> >; _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<vector<int>*, vector<vector<int> > >; _Tp = vector<vector<int> >]'
2028 | return std::__upper_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
2029 | __gnu_cxx::__ops::__val_less_iter());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:37:22: required from here
37 | tt+=upper_bound(t.begin(),t.end(),t)-lower_bound(t.begin(),t.end(),t);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:98:22: error: no match for 'operator<' (operand types are 'const std::vector<std::vector<int> >' and 'std::vector<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::vector<std::vector<int> >' 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::vector<std::vector<int> >' 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::vector<std::vector<int> >' 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::vector<std::vector<int> >' 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::vector<std::vector<int> >' 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::vector<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::vector<std::vector<int> >' 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::vector<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::vector<std::vector<int> >' 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: 'const std::vector<std::vector<int> >' is not derived from 'const std::pair<_T1, _T2>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::vector<std::vector<int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::vector<std::vector<int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/
|
s468902205
|
p03968
|
C++
|
#include <bits/stdc++.h>
//#include <boost/functional/hash.hpp>
//example: unordered_set< pair<int,int>,boost::hash< std::pair<int, int> > > used;
//priority_queue< pair<int,pair<int,int> >, vector<pair<int,pair<int,int>>>, greater<pair<int,pair<int,int> > > > pqueue; //cost, vertex(行き先)
using namespace std;
#define module 1000000007
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define int long long
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 = 100001;
/*struct edge {
edge(int to, int cost) : to(to), cost(cost) {}
int to, cost;
};
vector<edge> graph[MAXN];*/
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
//-----Template---------
//pure
LL compress(vector<int>& v){ //10^3*4->10^12
LL r=0;
for (int i = 0; i < v.size(); ++i) {
r=r*1000+v[i];
}
return r;
}
vector<int> getMinVector(vector<int> v){
vector<vector<int>> tmpVecs;
tmpVecs.push_back(v);
for (int i = 1; i < 4; ++i) {
rotate(v.begin(),v.begin()+1,v.end()); //begin to end, begin+1が先頭に来るように左に回す
//右に回すときには rotate(v.rbegin(),v.rbegin()+1,v.rend()) とrbeginを使う
tmpVecs.push_back(v);
}
sort(all(tmpVecs));
/*sort(tmpVecs.begin(),tmpVecs.end(),[](vector<int> a,vector<int> b){
if(a.size()==0)return true;
for (int i = 0; i < a.size(); ++i) {
if(a[i]!=b[i]){
return a[i]<b[i];
}
}
return true;
});*/
return tmpVecs[0];
}
//pure
int getWay(vector<int>& v){
int wayNum=1;
if(v[0] == v[1] && v[1]==v[2] && v[2]==v[3]){
wayNum=4;
}else if(v[0]==v[2] && v[1]==v[3]){
wayNum=2;
}
return wayNum;
}
int getWay2(vector<int> v){
set<vector<int>> s;
for (int i = 0; i < 4; ++i) {
s.insert(v);
rotate(v.begin(),v.begin()+1,v.end());
}
return 4/s.size();
}
int n, counter;
//string tile[401];
vector<vector<int>> tile(401);
unordered_map<LL,LL> cnt;
unordered_map<LL,LL> way;
int main() {
ios::sync_with_stdio(false); //cout<< fixed << setprecision(10);
cin >> n;
for (int i = 0; i < n; ++i) {
vector<int> v(4);
for (int j = 0; j < 4; ++j) {
cin>>v[j];
}
v=getMinVector(v);
tile[i]=v;
LL minTile=compress(v);
cnt[minTile]++;
way[minTile]=getWay2(v);
}
int ans=0;
for (int i = 0; i < n; ++i) {
vector<int> ue = tile[i];
LL ueLL=compress(ue);
cnt[ueLL]--;
for (int j = i + 1; j < n; ++j) {
vector<int> sita = tile[j];
LL sitaLL=compress(sita);
cnt[sitaLL]--;
swap(sita[1],sita[3]);
for (int k = 0; k < 4; ++k) { //sitaを回転
map<LL,int> sokuTile;
for (int l = 0; l < 4; ++l) { //側面のタイルを書き出す
vector<int> tmpTile(4);
/*tmpTile[0]=ue[l];
tmpTile[1]=ue[(l+3)%4];
tmpTile[2]=sita[(l+3)%4];
tmpTile[3]=sita[l];*/
tmpTile[0]=ue[(l+1)%4];
tmpTile[1]=ue[l];
tmpTile[2]=sita[l];
tmpTile[3]=sita[(l+1)%4];
tmpTile=getMinVector(tmpTile);
sokuTile[compress(tmpTile)]++;
}
LL resTmp=1;
for (auto it : sokuTile) {
if(cnt.find(it.first)==cnt.end()){
resTmp*=0; break;
}
if(it.second==1){
resTmp*=cnt[it.first]*way[it.first];
}else{
for (int l = 0; l < it.second; ++l) {
resTmp*=(cnt[it.first]-l)*way[it.first];
}
}
}
ans+=resTmp;
rotate(sita.begin(),sita.begin()+1,sita.end());
}
cnt[sitaLL]++;
}
cnt[ueLL]++;
}
cout<<ans/3<<endl;
}
|
cc1plus: error: '::main' must return 'int'
|
s565519313
|
p03968
|
Java
|
// -*- coding: utf-8 -*-
//import java.awt.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream;
if (args.length > 0 && args[0].equals("devTesting")) {
try {
inputStream = new FileInputStream(args[1]);
} catch(FileNotFoundException e) {
throw new RuntimeException(e);
}
} else {
inputStream = System.in;
}
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskE solver = new TaskE();
solver.solve(1, in, out);
out.close();
}
static class TaskE {
final long ring = 9223372036854775783L;
int n;
int[][] c;
void solve(int testNumber, InputReader in, PrintWriter out) {
n = in.nextInt();
c = new int[n][4];
for (int i = 0; i < n; ++i)
for (int j = 0; j < 4; ++j)
c[i][j] = in.nextInt();
int ptr = 0;
Map<Long, Integer> table = new HashMap<Long, Integer>();
for (int i = 0; i < n; ++i) {
long mask = pack(c[i][3], c[i][2], c[i][1], c[i][0]);
for (int j = 0; j < 4; ++j) {
if (!table.containsKey(mask))
table.put(mask, ptr++);
mask = rotater(mask);
}
}
int[] count = new int[ptr];
for (int i = 0; i < n; ++i) {
long mask = pack(c[i][3], c[i][2], c[i][1], c[i][0]);
for (int j = 0; j < 4; ++j) {
++count[table.get(mask)];
mask = rotater(mask);
}
}
long acc = 0;
boolean flag = false;
List<Long> list = new ArrayList<Long>();
for (int i = 0; i < n; ++i) {
long lmask = pack(c[i][3], c[i][2], c[i][1], c[i][0]);
Deque<Integer> queue1 = new ArrayDeque<Integer>();
long bk1 = lmask;
for (int j = 0; j < 4; ++j) {
int idx = table.get(bk1);
queue1.add(idx);
--count[idx];
bk1 = rotater(bk1);
}
for (int j = 0; j < 4; ++j) {
for (int k = 0; k < n; ++k)
if (k != i) {
long rmask = pack(c[k][3], c[k][2], c[k][1], c[k][0]);
Deque<Integer> queue2 = new ArrayDeque<Integer>();
long bk2 = rmask;
for (int p = 0; p < 4; ++p) {
int idx = table.get(bk2);
queue2.add(idx);
--count[idx];
bk2 = rotater(bk2);
}
for (int p = 0; p < 4; ++p) {
long prod = 1;
long rrmask = rmask;
long llmask = lmask;
boolean okay = true;
Deque<Integer> queue3 = new ArrayDeque<Integer>();
for (int q = 0; q < 4; ++q) {
long mask = pack(extract(llmask, 16, 16), extract(rrmask, 0, 16), extract(rrmask, 16, 16), extract(llmask, 0, 16));
if (table.containsKey(mask)) {
prod *= count[table.get(mask)];
long bk3 = mask;
for (int r = 0; r < 4; ++r) {
int idx = table.get(bk3);
queue3.add(idx);
--count[idx];
bk3 = rotater(bk3);
}
} else
okay = false;
llmask = rotater(llmask);
rrmask = rotatel(rrmask);
}
if (okay) {
acc += prod;
if (acc > Long.MAX_VALUE / 48 && acc % 24 == 0) {
list.add(acc);
acc = 0;
}
}
while (!queue3.isEmpty()) {
int idx = queue3.poll();
++count[idx];
}
rmask = rotater(rmask);
}
while (!queue2.isEmpty()) {
int idx = queue2.poll();
++count[idx];
}
}
lmask = rotater(lmask);
}
while (!queue1.isEmpty()) {
int idx = queue1.poll();
++count[idx];
}
}
long ans = 0;
for (long i : list)
ans += i / 24;
ans += acc / 24;
out.println(ans);
}
long pack(long a, long b, long c, long d) {
return a << 48 | b << 32 | c << 16 | d;
}
long extract(long a, int offset, int size) {
return a >>> offset & (1L << size) - 1;
}
long rotater(long a) {
return a << 16 | a >>> 48;
}
long rotatel(long a) {
return a >>> 16 | a << 48;
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
try {
return reader.readLine();
} catch(IOException e) {
throw new RuntimeException(e);
}
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public boolean hasInput() {
try {
if (tokenizer != null && tokenizer.hasMoreTokens()) {
return true;
}
reader.mark(1);
int ch = reader.read();
if (ch != -1) {
reader.reset();
return true;
}
return false;
} catch(IOException e) {
throw new RuntimeException(e);
}
}
}
}
|
Main.java:7: error: illegal character: '\u00a0'
?
^
Main.java:157: error: illegal character: '\u00a0'
?
^
Main.java:162: error: illegal character: '\u00a0'
?
^
Main.java:181: error: illegal character: '\u00a0'
?
^
Main.java:185: error: illegal character: '\u00a0'
?
^
Main.java:193: error: illegal character: '\u00a0'
?
^
6 errors
|
s830394653
|
p03968
|
Java
|
// -*- coding: utf-8 -*-
//import java.awt.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream;
if (args.length > 0 && args[0].equals("devTesting")) {
try {
inputStream = new FileInputStream(args[1]);
} catch(FileNotFoundException e) {
throw new RuntimeException(e);
}
} else {
inputStream = System.in;
}
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskE solver = new TaskE();
solver.solve(1, in, out);
out.close();
}
static class TaskE {
final long ring = 9223372036854775783L;
int n;
int[][] c;
void solve(int testNumber, InputReader in, PrintWriter out) {
n = in.nextInt();
c = new int[n][4];
for (int i = 0; i < n; ++i)
for (int j = 0; j < 4; ++j)
c[i][j] = in.nextInt();
int ptr = 0;
Map<Long, Integer> table = new HashMap<Long, Integer>();
for (int i = 0; i < n; ++i) {
long mask = pack(c[i][3], c[i][2], c[i][1], c[i][0]);
for (int j = 0; j < 4; ++j) {
if (!table.containsKey(mask))
table.put(mask, ptr++);
mask = rotater(mask);
}
}
int[] count = new int[ptr];
for (int i = 0; i < n; ++i) {
long mask = pack(c[i][3], c[i][2], c[i][1], c[i][0]);
for (int j = 0; j < 4; ++j) {
++count[table.get(mask)];
mask = rotater(mask);
}
}
long acc = 0;
boolean flag = false;
List<Long> list = new ArrayList<Long>();
for (int i = 0; i < n; ++i) {
long lmask = pack(c[i][3], c[i][2], c[i][1], c[i][0]);
Deque<Integer> queue1 = new ArrayDeque<Integer>();
long bk1 = lmask;
for (int j = 0; j < 4; ++j) {
int idx = table.get(bk1);
queue1.add(idx);
--count[idx];
bk1 = rotater(bk1);
}
for (int j = 0; j < 4; ++j) {
for (int k = 0; k < n; ++k)
if (k != i) {
long rmask = pack(c[k][3], c[k][2], c[k][1], c[k][0]);
Deque<Integer> queue2 = new ArrayDeque<Integer>();
long bk2 = rmask;
for (int p = 0; p < 4; ++p) {
int idx = table.get(bk2);
queue2.add(idx);
--count[idx];
bk2 = rotater(bk2);
}
for (int p = 0; p < 4; ++p) {
long prod = 1;
long rrmask = rmask;
long llmask = lmask;
boolean okay = true;
Deque<Integer> queue3 = new ArrayDeque<Integer>();
for (int q = 0; q < 4; ++q) {
long mask = pack(extract(llmask, 16, 16), extract(rrmask, 0, 16), extract(rrmask, 16, 16), extract(llmask, 0, 16));
if (table.containsKey(mask)) {
prod *= count[table.get(mask)];
long bk3 = mask;
for (int r = 0; r < 4; ++r) {
int idx = table.get(bk3);
queue3.add(idx);
--count[idx];
bk3 = rotater(bk3);
}
} else
okay = false;
llmask = rotater(llmask);
rrmask = rotatel(rrmask);
}
if (okay) {
acc += prod;
if (acc > Long.MAX_VALUE / 48 && acc % 24 == 0) {
list.add(acc);
acc = 0;
}
}
while (!queue3.isEmpty()) {
int idx = queue3.poll();
++count[idx];
}
rmask = rotater(rmask);
}
while (!queue2.isEmpty()) {
int idx = queue2.poll();
++count[idx];
}
}
lmask = rotater(lmask);
}
while (!queue1.isEmpty()) {
int idx = queue1.poll();
++count[idx];
}
}
long ans = 0;
for (long i : list)
ans += i / 24;
ans += acc / 24;
out.println(ans);
}
long pack(long a, long b, long c, long d) {
return a << 48 | b << 32 | c << 16 | d;
}
long extract(long a, int offset, int size) {
return a >>> offset & (1L << size) - 1;
}
long rotater(long a) {
return a << 16 | a >>> 48;
}
long rotatel(long a) {
return a >>> 16 | a << 48;
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
try {
return reader.readLine();
} catch(IOException e) {
throw new RuntimeException(e);
}
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public boolean hasInput() {
try {
if (tokenizer != null && tokenizer.hasMoreTokens()) {
return true;
}
reader.mark(1);
int ch = reader.read();
if (ch != -1) {
reader.reset();
return true;
}
return false;
} catch(IOException e) {
throw new RuntimeException(e);
}
}
}
}
|
Main.java:7: error: illegal character: '\u00a0'
?
^
Main.java:157: error: illegal character: '\u00a0'
?
^
Main.java:162: error: illegal character: '\u00a0'
?
^
Main.java:181: error: illegal character: '\u00a0'
?
^
Main.java:185: error: illegal character: '\u00a0'
?
^
Main.java:193: error: illegal character: '\u00a0'
?
^
6 errors
|
s368641468
|
p03968
|
Java
|
package main;
import util.FastScanner;
import java.io.PrintWriter;
import java.util.Arrays;
public class ProblemC {
public void solve(int testNumber, FastScanner in, PrintWriter out) {
int n = in.nextInt();
int[][] col = new int[n][4];
long[][] hash = new long[n][4];
for (int i = 0; i < n; i++) {
for (int j = 0; j < 4; j++) {
col[i][j] = in.nextInt();
}
for (int rot = 0; rot < 4; rot++) {
for (int j = 0; j < 4; j++) {
hash[i][rot] = 1000 * hash[i][rot] + col[i][(rot + j) % 4];
}
}
}
long ans = 0;
long[] dp = new long[1 << 4];
int[] ways = new int[4];
for (int front = 0; front < n; front++) {
int a = col[front][0];
int b = col[front][1];
int c = col[front][2];
int d = col[front][3];
for (int back = front + 1; back < n; back++) {
rotLoop:
for (int rotBack = 0; rotBack < 4; rotBack++) {
int f = col[back][(rotBack + 0) % 4];
int e = col[back][(rotBack + 1) % 4];
int h = col[back][(rotBack + 2) % 4];
int g = col[back][(rotBack + 3) % 4];
long h1 = calcHash(a, e, f, b);
long h2 = calcHash(b, f, g, c);
long h3 = calcHash(d, c, g, h);
long h4 = calcHash(e, a, d, h);
long[] hs = {h1, h2, h3, h4};
Arrays.fill(dp, 0);
dp[0] = 1;
for (int i = front + 1; i < n; i++) {
if (i == back) {
continue;
}
Arrays.fill(ways, 0);
for (int bit = 0; bit < 4; bit++) {
for (int rot = 0; rot < 4; rot++) {
if (hash[i][rot] == hs[bit]) {
++ways[bit];
}
}
}
/*
for (int mask = 15; mask >= 0; mask--) {
if (dp[mask] == 0) {
continue;
}
for (int bit = 0; bit < 4; bit++) {
int nmask = mask | (1 << bit);
if (nmask != mask) {
dp[nmask] += dp[mask] * ways[bit];
}
}
}
*/
dp[15] += dp[14] * ways[0];
dp[15] += dp[13] * ways[1];
dp[15] += dp[11] * ways[2];
dp[15] += dp[7] * ways[3];
dp[14] += dp[12] * ways[1];
dp[14] += dp[10] * ways[2];
dp[14] += dp[6] * ways[3];
dp[13] += dp[12] * ways[0];
dp[13] += dp[9] * ways[2];
dp[13] += dp[5] * ways[3];
dp[12] += dp[8] * ways[2];
dp[12] += dp[4] * ways[3];
dp[11] += dp[10] * ways[0];
dp[11] += dp[9] * ways[1];
dp[11] += dp[3] * ways[3];
dp[10] += dp[8] * ways[1];
dp[10] += dp[2] * ways[3];
dp[9] += dp[8] * ways[0];
dp[9] += dp[1] * ways[3];
dp[8] += dp[0] * ways[3];
dp[7] += dp[6] * ways[0];
dp[7] += dp[5] * ways[1];
dp[7] += dp[3] * ways[2];
dp[6] += dp[4] * ways[1];
dp[6] += dp[2] * ways[2];
dp[5] += dp[4] * ways[0];
dp[5] += dp[1] * ways[2];
dp[4] += dp[0] * ways[2];
dp[3] += dp[2] * ways[0];
dp[3] += dp[1] * ways[1];
dp[2] += dp[0] * ways[1];
dp[1] += dp[0] * ways[0];
}
ans += dp[15];
}
}
}
out.println(ans);
}
private long calcHash(int a, int b, int c, int d) {
long h = 0;
h = 1000 * h + a;
h = 1000 * h + b;
h = 1000 * h + c;
h = 1000 * h + d;
return h;
}
}
|
Main.java:8: error: class ProblemC is public, should be declared in a file named ProblemC.java
public class ProblemC {
^
Main.java:3: error: package util does not exist
import util.FastScanner;
^
Main.java:9: error: cannot find symbol
public void solve(int testNumber, FastScanner in, PrintWriter out) {
^
symbol: class FastScanner
location: class ProblemC
3 errors
|
s600398401
|
p03968
|
C++
|
#include <cstdio>
#include <set>
#include <vector>
using namespace std;
int nextInt() {
int x;
scanf("%d", &x);
return x;
}
const int N = 400;
int col[N][8];
long long hashes[N][4];
long long dp[16];
int ways[4];
long long calcHash(int a, int b, int c, int d) {
long long h = 0;
h = 1000 * h + a;
h = 1000 * h + b;
h = 1000 * h + c;
h = 1000 * h + d;
return h;
}
int main() {
int n = nextInt();
for (int i = 0; i < n; i++) {
for (int j = 0; j < 4; j++) {
col[i][j] = nextInt();
col[i][j + 4] = col[i][j];
}
for (int rot = 0; rot < 4; rot++) {
for (int j = 0; j < 4; j++) {
hashes[i][rot] = 1000 * hashes[i][rot] + col[i][(rot + j) % 4];
}
any.insert(hashes[i][rot]);
}
}
long long ans = 0;
for (int front = 0; front < n; front++) {
int a = col[front][0];
int b = col[front][1];
int c = col[front][2];
int d = col[front][3];
for (int back = front + 1; back < n; back++) {
rotLoop:
for (int rotBack = 0; rotBack < 4; rotBack++) {
int f = col[back][(rotBack + 0)];
int e = col[back][(rotBack + 1)];
int h = col[back][(rotBack + 2)];
int g = col[back][(rotBack + 3)];
long long h1 = calcHash(a, e, f, b);
long long h2 = calcHash(b, f, g, c);
long long h3 = calcHash(d, c, g, h);
long long h4 = calcHash(e, a, d, h);
vector<long long> hs = {h1, h2, h3, h4};
for (int i = 0; i < 16; i++) {
dp[i] = 0;
}
dp[0] = 1;
for (int i = front + 1; i < n; i++) {
if (i == back) {
continue;
}
for (int j = 0; j < 4; j++) {
ways[j] = 0;
}
for (int bit = 0; bit < 4; bit++) {
for (int rot = 0; rot < 4; rot++) {
if (hashes[i][rot] == hs[bit]) {
++ways[bit];
}
}
}
for (int mask = 15; mask >= 0; mask--) {
if (dp[mask] == 0) {
continue;
}
for (int bit = 0; bit < 4; bit++) {
if ((mask & (1 << bit)) != 0) {
continue;
}
dp[mask | (1 << bit)] += dp[mask] * ways[bit];
}
}
}
ans += dp[15];
}
}
}
printf("%lld\n", ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:38:25: error: 'any' was not declared in this scope
38 | any.insert(hashes[i][rot]);
| ^~~
a.cc:4:1: note: 'std::any' is defined in header '<any>'; this is probably fixable by adding '#include <any>'
3 | #include <vector>
+++ |+#include <any>
4 | using namespace std;
|
s029057247
|
p03968
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define f first
#define s second
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%I64d",&x)
#define CLR(x) memset(x,0,sizeof(x))
#define RESET(x,a) memset(x,a,sizeof(x))
#define pi pair<int,int>
#define pb push_back
#define mp make_pair
#define debug(x) cerr<<">value ("<<#x<<") : "<<x<<endl;
#define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
const int N=405;
int a[N][4]; //tile
ll val[N]; //hash of tile
int p[4];
int sym[4];
ll g[4];
ll ans[16];
int n;
inline ll h(int p[4],int k)
{
ll res=0LL;
for(int i=k;i<4;i++)
res = res<<10LL | (ll)p[i];
for(int i=0;i<k;i++)
res = res<<10LL | (ll)p[i];
return res;
}
ll normalise(int p[4])
{
return min(h(p,0),min(h(p,1),min(h(p,2),h(p,3))));
}
ll way(int x, int y, int r)
{
int i,j,k,b[4];
for(i=0;i<4;i++)
b[i]=a[y][ (i+r)%4 ];
ll e,f,c,d;
sym[0]=sym[1]=sym[2]=sym[3]=1;
p[0]=b[1]; p[1]=b[0];
p[2]=a[x][1]; p[3]=a[x][0];
e=h(p,0); f=h(p,1); c=h(p,2); d=h(p,3);
if(e==f)sym[0]=4;
else if(e==c)sym[0]=2;
g[0]=min(e,min(f,min(c,d)));
p[0]=b[0]; p[1]=b[3];
p[2]=a[x][2]; p[3]=a[x][1];
e=h(p,0); f=h(p,1); c=h(p,2); d=h(p,3);
if(e==f)sym[1]=4;
else if(e==c)sym[1]=2;
g[1]=min(e,min(f,min(c,d)));
p[0]=b[2]; p[1]=b[1];
p[2]=a[x][0]; p[3]=a[x][3];
e=h(p,0); f=h(p,1); c=h(p,2); d=h(p,3);
if(e==f)sym[2]=4;
else if(e==c)sym[2]=2;
g[2]=min(e,min(f,min(c,d)));
p[0]=b[3]; p[1]=b[2];
p[2]=a[x][3]; p[3]=a[x][2];
e=h(p,0); f=h(p,1); c=h(p,2); d=h(p,3);
if(e==f)sym[3]=4;
else if(e==c)sym[3]=2;
g[3]=min(e,min(f,min(c,d)));
CLR(ans);
ans[0]=1;
for(i=x+1;i<n;i++)
{
if(i==y)continue;
F(14,0); F(14,1); F(14,2); F(14,3);
F(13,0); F(13,1); F(13,2); F(13,3);
F(12,0); F(12,1); F(12,2); F(12,3);
F(11,0); F(11,1); F(11,2); F(11,3);
F(10,0); F(10,1); F(10,2); F(10,3);
F(9,0); F(9,1); F(9,2); F(9,3);
F(8,0); F(8,1); F(8,2); F(8,3);
F(7,0); F(7,1); F(7,2); F(7,3);
F(6,0); F(6,1); F(6,2); F(6,3);
F(5,0); F(5,1); F(5,2); F(5,3);
F(4,0); F(4,1); F(4,2); F(4,3);
F(3,0); F(3,1); F(3,2); F(3,3);
F(2,0); F(2,1); F(2,2); F(2,3);
F(1,0); F(1,1); F(1,2); F(1,3);
F(0,0); F(0,1); F(0,2); F(0,3);
// for(j=14;j>=0;j--)
// {
// for(k=0;k<4;k++)
// {
// if(j&(1<<k))continue;
// if(val[i]==g[k])
// ans[j|(1<<k)] += sym[k]*ans[j];
// }
// }
}
return ans[15];
}
int main()
{
int i,j,k;
si(n);
for(i=0;i<n;i++)
{
for(j=0;j<4;j++)
si(a[i][j]);
val[i] = normalise(a[i]);
}
ll ans=0LL;
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
for(k=0;k<4;k++)
ans+=way(i,j,k);
printf("%lld\n",ans);
return 0;
}
|
a.cc: In function 'long long int way(int, int, int)':
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:81:9: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:81:9: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:81:9: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:81:18: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:81:18: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:81:18: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:81:27: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:81:27: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:81:27: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:81:36: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:81:36: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:81:36: note: in expansion of macro 'F'
81 | F(14,0); F(14,1); F(14,2); F(14,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:82:9: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:82:9: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:82:9: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:82:18: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:82:18: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:82:18: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:82:27: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:82:27: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:82:27: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:82:36: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:82:36: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:82:36: note: in expansion of macro 'F'
82 | F(13,0); F(13,1); F(13,2); F(13,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:83:9: note: in expansion of macro 'F'
83 | F(12,0); F(12,1); F(12,2); F(12,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:83:9: note: in expansion of macro 'F'
83 | F(12,0); F(12,1); F(12,2); F(12,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:83:9: note: in expansion of macro 'F'
83 | F(12,0); F(12,1); F(12,2); F(12,3);
| ^
a.cc:15:43: error: invalid types 'long long int[int]' for array subscript
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^
a.cc:83:18: note: in expansion of macro 'F'
83 | F(12,0); F(12,1); F(12,2); F(12,3);
| ^
a.cc:15:52: error: 'dp' was not declared in this scope; did you mean 'd'?
15 | #define F(j,k) if ( !((j>>k)&1) && b[i]==c[k][0] ) dp[j|(1<<k)]+=rc[k]*dp[j]
| ^~
a.cc:83:18: note: in expansion of macro 'F'
83 | F(12,0); F(12,1); F(12,2); F(12,3);
| ^
a.cc:15:66: error: 'rc' was not declared in this scope; did you mean 'c'?
15 | #define F(j,k) if ( !((j>>k)&1)
|
s244190660
|
p03968
|
C++
|
#include <bits/stdc++.h>
#define DEBUG 1
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef pair<int, int> PII;
#define MAX_INT (int)0x7fffffff
#define MIN_INT (int)0x80000000
#define MAX_UINT (uint)0xffffffff
#define TTi template<typename T> inline
TTi T SQR(T x) { return x * x; }
#define CONCAT3_NX(x, y, z) x ## y ## z
#define CONCAT3(x, y, z) CONCAT3_NX(x, y, z)
#define VAR(name) CONCAT3(__tmpvar__, name, __LINE__)
#define TYPE(x) __typeof(x)
#define FOR(i, s, n) for (TYPE(n) i=(s), VAR(end)=(n); i < VAR(end); i++)
#define RFOR(i, s, n) for (TYPE(n) i=(n)-1, VAR(end)=(s); i >= VAR(end); i--)
#define FORN(i, n) FOR(i, 0, n)
#define RFORN(i, n) RFOR(i, 0, n)
#define FOREACH(i, v) for (auto& i: v)
#define SC() scanf("\n")
#define SC1(fmt, a) scanf(fmt, &a)
#define SC2(fmt, a, b) scanf(fmt, &a, &b)
#define SC3(fmt, a, b, c) scanf(fmt, &a, &b, &c)
#define SCi(a) scanf("%d", &a)
#define SCii(a,b) scanf("%d%d", &a, &b)
#define SCiii(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define fLL "%lld"
#define SCl(a) scanf(fLL, &a)
#define SCll(a,b) scanf(fLL fLL, &a, &b)
#define SClll(a,b,c) scanf(fLL fLL fLL, &a, &b, &c)
#define SCs(s, n) {scanf("%s", s); n = strlen(s);}
#define SCc(s) scanf("%c", &c)
#define MP make_pair
#define PB push_back
#define WHOLE(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define POPST(stack) (stack).top();(stack).pop();
#define POPQ(queue) (queue).front();(queue).pop();
#define CONTAINS(v, x) (find(WHOLE(v), (x)) != v.end())
#define SORT(v) (sort(WHOLE(v)))
#define LIMIT(x, lim) {if (x > lim) x = lim;}
TTi void UPDATE_MIN(T &x, T y) {if (y < x) {x = y;}}
TTi void UPDATE_MAX(T &x, T y) {if (x < y) {x = y;}}
TTi int ARGMAX(T cont) { return max_element(cont.begin(), cont.end()) - cont.begin(); }
TTi int ARGMIN(T cont) { return min_element(cont.begin(), cont.end()) - cont.begin(); }
TTi int hamming(T x) {return __builtin_popcountll((long long)x);}
int hamming(int x) {return __builtin_popcount(x);}
int hamming(long x) {return __builtin_popcountl(x);}
int hamming(long long x) {return __builtin_popcountll(x);}
vector<string> split(const string& s, char c) {
vector<string> v; stringstream ss(s); string x;
while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
stringstream s; s << "[";
FORN(i, n - 1) s << arr[i] << ",";
s << arr[n - 1] << "]";
return s.str();
}
// #ifndef ONLINE_JUDGE
#ifdef JUDGE_LOCAL
#define EPR(args...) if (DEBUG) {fprintf(stderr, args);}
#define EARR(arr, n) if (DEBUG) {FORN(i, n) fprintf(stderr, "%d, ", arr[i]);}
#define EVEC(arr) if (DEBUG) {FORN(i, arr.size()) fprintf(stderr, "%d, ", arr[i]);}
#define EVARS(args...) if (DEBUG) { __evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }
TTi void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
TTi void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
TTi void __evars_out_var(T val) { cerr << val; }
template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
__evars_out_var(a);
cerr << "; ";
__evars(++it, args...);
}
#else
#define EPR(args...) 1
#define EARR(args...) 1
#define EVEC(args...) 1
#define EVARS(args...) 1
#endif
template<class T> inline string TOSTR(const T & x) { stringstream ss; ss << x; return ss.str(); }
#define DIE(args...) {printf(args);exit(0);}
inline void PR(void) {}
inline void PR(int x) {printf("%d", x);}
inline void PR(LL x) {printf("%lld", x);}
inline void PR(size_t x) {printf("%llu", (ULL)x);}
inline void PR(const char * s) {printf("%s", s);}
inline void PR(double f) {printf("%.10f", f);}
inline void PR(long double f) {printf("%.10f", (double)f);}
TTi void PR(vector<T> &vec) {auto sz = vec.size();for(auto x:vec){PR(x);(--sz)?putc(0x20,stdout):0;}}
TTi void PRS(T x) {PR(x);putc(0x20,stdout);}
TTi void PRN(T x) {PR(x);putc(0x0a,stdout);}
void PRN(void) {putc(0x0a,stdout);}
struct pairhash {
template <typename T, typename U>
std::size_t operator() (const std::pair<T, U> &x) const {
return std::hash<T>()(x.first) ^ std::hash<U>()(x.second);
}
};
const int MOD = 1000 * 1000 * 1000 + 7;
const double PI = 3.1415926535897932384626433832795l;
TTi T gcd(T a, T b) {
return a ? gcd(b % a, a) : b;
}
inline void addto(int &a, int b) {
a += b;
if (a >= MOD) a -= MOD;
}
inline int add(int a, int b) {
a += b;
if (a >= MOD) a -= MOD;
return a;
}
inline void subto(int &a, int b) {
a -= b;
if (a < 0) a += MOD;
if (a >= MOD) a -= MOD;
}
inline int sub(int a, int b) {
a -= b;
if (a < 0) a += MOD;
if (a >= MOD) a -= MOD;
return a;
}
inline void multo(int &a, int b) {
a = (long long)a * b % MOD;
}
inline int mul(int a, int b) {
return (long long)a * b % MOD;
}
inline int mulmod(int a, int b, int mod) {
return (long long)a * b % mod;
}
inline int powmod(int a, int e, int mod) {
int x;
for(x = 1; e > 0; e >>= 1) {
if (e & 1)
x = mulmod(x, a, mod);
a = mulmod(a, a, mod);
}
return x;
}
inline int invmod_prime(int a, int mod) {
return powmod(a, mod - 2, mod);
}
inline LL invmod_LL(LL p){
LL q = p;
for(LL a = p*p; a != 1; a*=a) q*=a;
return q;
}
// -----------------------------------------------------------------
// CODE
// -----------------------------------------------------------------
int N, M, K, L, E, Q;
struct Colors {
int colors[4];
inline void normalize() {
int i = (less(0, 1)) ? 0 : 1;
int j = (less(2, 3)) ? 2 : 3;
int ans = (less(i, j)) ? i : j;
rotate_left(ans);
}
inline void rotate_left(int num) {
int tmp[4];
FORN(i, 4) tmp[i] = colors[(num+i) & 3];
FORN(i, 4) colors[i] = tmp[i];
}
inline int mult() const {
int ans = 1;
FOR(i, 1, 4)
if ((!less(0, i)) && (!less(i, 0)))
ans++;
return ans;
}
inline bool less(int i, int j) const {
FORN(k, 4) {
if (colors[(i+k)&3] < colors[(j+k)&3]) return true;
if (colors[(i+k)&3] > colors[(j+k)&3]) return false;
}
return false;
}
inline bool operator<(const Colors &other) const {
FORN(k, 4) {
if (colors[k] < other.colors[k]) return true;
if (colors[k] > other.colors[k]) return false;
}
return false;
}
inline bool operator==(const Colors &other) const {
return (!(*this < other)) && (!(other < *this));
}
inline Colors pair(const Colors &other, int offset) const {
Colors ans;
if (offset == 0) {
ans.colors[0] = colors[0];
ans.colors[1] = other.colors[1];
ans.colors[2] = other.colors[0];
ans.colors[3] = colors[1];
}
else if (offset == 1) {
ans.colors[0] = colors[1];
ans.colors[1] = other.colors[0];
ans.colors[2] = other.colors[3];
ans.colors[3] = colors[2];
}
else if (offset == 2) {
ans.colors[0] = colors[2];
ans.colors[1] = other.colors[3];
ans.colors[2] = other.colors[2];
ans.colors[3] = colors[3];
}
else if (offset == 3) {
ans.colors[0] = colors[3];
ans.colors[1] = other.colors[2];
ans.colors[2] = other.colors[1];
ans.colors[3] = colors[0];
}
else {
assert(0);
}
ans.normalize();
return ans;
}
};
map<Colors, int> colcnt;
vector<Colors> tiles;
LL countfit(Colors &a, Colors &b, Colors &brot) {
Colors dst[4] = {
a.pair(brot, 0),
a.pair(brot, 1),
a.pair(brot, 2),
a.pair(brot, 3),
};
LL ans = 1;
FORN(i, 4) {
auto &c = dst[i];
ans *= 1ll * colcnt[c] * c.mult();
colcnt[c]--;
}
FORN(i, 4) {
auto &c = dst[i];
colcnt[c]++;
}
return ans;
}
LL countSmallest(Colors a) {
LL ans = 0;
FOREACH(pb, colcnt) {
if (!pb.second) continue;
Colors b = pb.first;
Colors brot = pb.first;
colcnt[b]--;
FORN(rot, 4) {
ans += multi * countfit(a, b, brot);
brot.rotate_left(1);
}
colcnt[b]++;
}
return ans;
}
int main() {
ios_base::sync_with_stdio(0);
SCi(N);
FORN(i, N) {
Colors c;
FORN(j, 4)
SCi(c.colors[j]);
c.normalize();
colcnt[c]++;
tiles.push_back(c);
}
LL ans = 0;
FORN(i, (int)tiles.size()) {
Colors a = tiles[i];
colcnt[a]--;
ans += countSmallest(a);
}
PRN(ans);
return 0;
}
|
a.cc: In function 'LL countSmallest(Colors)':
a.cc:288:20: error: 'multi' was not declared in this scope; did you mean 'multo'?
288 | ans += multi * countfit(a, b, brot);
| ^~~~~
| multo
|
s701103571
|
p03968
|
C++
|
#include <bits/stdc++.h>
#define DEBUG 1
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef pair<int, int> PII;
#define MAX_INT (int)0x7fffffff
#define MIN_INT (int)0x80000000
#define MAX_UINT (uint)0xffffffff
#define TTi template<typename T> inline
TTi T SQR(T x) { return x * x; }
#define CONCAT3_NX(x, y, z) x ## y ## z
#define CONCAT3(x, y, z) CONCAT3_NX(x, y, z)
#define VAR(name) CONCAT3(__tmpvar__, name, __LINE__)
#define TYPE(x) __typeof(x)
#define FOR(i, s, n) for (TYPE(n) i=(s), VAR(end)=(n); i < VAR(end); i++)
#define RFOR(i, s, n) for (TYPE(n) i=(n)-1, VAR(end)=(s); i >= VAR(end); i--)
#define FORN(i, n) FOR(i, 0, n)
#define RFORN(i, n) RFOR(i, 0, n)
#define FOREACH(i, v) for (auto& i: v)
#define SC() scanf("\n")
#define SC1(fmt, a) scanf(fmt, &a)
#define SC2(fmt, a, b) scanf(fmt, &a, &b)
#define SC3(fmt, a, b, c) scanf(fmt, &a, &b, &c)
#define SCi(a) scanf("%d", &a)
#define SCii(a,b) scanf("%d%d", &a, &b)
#define SCiii(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define fLL "%lld"
#define SCl(a) scanf(fLL, &a)
#define SCll(a,b) scanf(fLL fLL, &a, &b)
#define SClll(a,b,c) scanf(fLL fLL fLL, &a, &b, &c)
#define SCs(s, n) {scanf("%s", s); n = strlen(s);}
#define SCc(s) scanf("%c", &c)
#define MP make_pair
#define PB push_back
#define WHOLE(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define POPST(stack) (stack).top();(stack).pop();
#define POPQ(queue) (queue).front();(queue).pop();
#define CONTAINS(v, x) (find(WHOLE(v), (x)) != v.end())
#define SORT(v) (sort(WHOLE(v)))
#define LIMIT(x, lim) {if (x > lim) x = lim;}
TTi void UPDATE_MIN(T &x, T y) {if (y < x) {x = y;}}
TTi void UPDATE_MAX(T &x, T y) {if (x < y) {x = y;}}
TTi int ARGMAX(T cont) { return max_element(cont.begin(), cont.end()) - cont.begin(); }
TTi int ARGMIN(T cont) { return min_element(cont.begin(), cont.end()) - cont.begin(); }
TTi int hamming(T x) {return __builtin_popcountll((long long)x);}
int hamming(int x) {return __builtin_popcount(x);}
int hamming(long x) {return __builtin_popcountl(x);}
int hamming(long long x) {return __builtin_popcountll(x);}
vector<string> split(const string& s, char c) {
vector<string> v; stringstream ss(s); string x;
while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
stringstream s; s << "[";
FORN(i, n - 1) s << arr[i] << ",";
s << arr[n - 1] << "]";
return s.str();
}
// #ifndef ONLINE_JUDGE
#ifdef JUDGE_LOCAL
#define EPR(args...) if (DEBUG) {fprintf(stderr, args);}
#define EARR(arr, n) if (DEBUG) {FORN(i, n) fprintf(stderr, "%d, ", arr[i]);}
#define EVEC(arr) if (DEBUG) {FORN(i, arr.size()) fprintf(stderr, "%d, ", arr[i]);}
#define EVARS(args...) if (DEBUG) { __evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }
TTi void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
TTi void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
TTi void __evars_out_var(T val) { cerr << val; }
template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
__evars_out_var(a);
cerr << "; ";
__evars(++it, args...);
}
#else
#define EPR(args...) 1
#define EARR(args...) 1
#define EVEC(args...) 1
#define EVARS(args...) 1
#endif
template<class T> inline string TOSTR(const T & x) { stringstream ss; ss << x; return ss.str(); }
#define DIE(args...) {printf(args);exit(0);}
inline void PR(void) {}
inline void PR(int x) {printf("%d", x);}
inline void PR(LL x) {printf("%lld", x);}
inline void PR(size_t x) {printf("%llu", (ULL)x);}
inline void PR(const char * s) {printf("%s", s);}
inline void PR(double f) {printf("%.10f", f);}
inline void PR(long double f) {printf("%.10f", (double)f);}
TTi void PR(vector<T> &vec) {auto sz = vec.size();for(auto x:vec){PR(x);(--sz)?putc(0x20,stdout):0;}}
TTi void PRS(T x) {PR(x);putc(0x20,stdout);}
TTi void PRN(T x) {PR(x);putc(0x0a,stdout);}
void PRN(void) {putc(0x0a,stdout);}
struct pairhash {
template <typename T, typename U>
std::size_t operator() (const std::pair<T, U> &x) const {
return std::hash<T>()(x.first) ^ std::hash<U>()(x.second);
}
};
const int MOD = 1000 * 1000 * 1000 + 7;
const double PI = 3.1415926535897932384626433832795l;
TTi T gcd(T a, T b) {
return a ? gcd(b % a, a) : b;
}
inline void addto(int &a, int b) {
a += b;
if (a >= MOD) a -= MOD;
}
inline int add(int a, int b) {
a += b;
if (a >= MOD) a -= MOD;
return a;
}
inline void subto(int &a, int b) {
a -= b;
if (a < 0) a += MOD;
if (a >= MOD) a -= MOD;
}
inline int sub(int a, int b) {
a -= b;
if (a < 0) a += MOD;
if (a >= MOD) a -= MOD;
return a;
}
inline void multo(int &a, int b) {
a = (long long)a * b % MOD;
}
inline int mul(int a, int b) {
return (long long)a * b % MOD;
}
inline int mulmod(int a, int b, int mod) {
return (long long)a * b % mod;
}
inline int powmod(int a, int e, int mod) {
int x;
for(x = 1; e > 0; e >>= 1) {
if (e & 1)
x = mulmod(x, a, mod);
a = mulmod(a, a, mod);
}
return x;
}
inline int invmod_prime(int a, int mod) {
return powmod(a, mod - 2, mod);
}
inline LL invmod_LL(LL p){
LL q = p;
for(LL a = p*p; a != 1; a*=a) q*=a;
return q;
}
// -----------------------------------------------------------------
// CODE
// -----------------------------------------------------------------
int N, M, K, L, E, Q;
struct Colors {
int colors[4];
inline void normalize() {
int i = (less(0, 1)) ? 0 : 1;
int j = (less(2, 3)) ? 2 : 3;
int ans = (less(i, j)) ? i : j;
rotate_left(ans);
}
inline void rotate_left(int num) {
int tmp[4];
FORN(i, 4) tmp[i] = colors[(num+i) & 3];
FORN(i, 4) colors[i] = tmp[i];
}
inline int mult() const {
int ans = 1;
FOR(i, 1, 4)
if ((!less(0, i)) && (!less(i, 0)))
ans++;
return ans;
}
inline bool less(int i, int j) const {
FORN(k, 4) {
if (colors[(i+k)&3] < colors[(j+k)&3]) return true;
if (colors[(i+k)&3] > colors[(j+k)&3]) return false;
}
return false;
}
inline bool operator<(const Colors &other) const {
FORN(k, 4) {
if (colors[k] < other.colors[k]) return true;
if (colors[k] > other.colors[k]) return false;
}
return false;
}
inline bool operator==(const Colors &other) const {
return (!(*this < other)) && (!(other < *this));
}
inline Colors pair(const Colors &other, int offset) const {
Colors ans;
if (offset == 0) {
ans.colors[0] = colors[0];
ans.colors[1] = other.colors[1];
ans.colors[2] = other.colors[0];
ans.colors[3] = colors[1];
}
else if (offset == 1) {
ans.colors[0] = colors[1];
ans.colors[1] = other.colors[0];
ans.colors[2] = other.colors[3];
ans.colors[3] = colors[2];
}
else if (offset == 2) {
ans.colors[0] = colors[2];
ans.colors[1] = other.colors[3];
ans.colors[2] = other.colors[2];
ans.colors[3] = colors[3];
}
else if (offset == 3) {
ans.colors[0] = colors[3];
ans.colors[1] = other.colors[2];
ans.colors[2] = other.colors[1];
ans.colors[3] = colors[0];
}
else {
assert(0);
}
ans.normalize();
return ans;
}
};
map<Colors, int> colcnt;
vector<Colors> tiles;
LL countfit(Colors &a, Colors &b, Colors &brot) {
Colors dst[4] = {
a.pair(brot, 0),
a.pair(brot, 1),
a.pair(brot, 2),
a.pair(brot, 3),
};
LL ans = 1;
FORN(i, 4) {
auto &c = dst[i];
ans *= 1ll * colcnt[c] * c.mult();
colcnt[c]--;
}
FORN(i, 4) {
auto &c = dst[i];
colcnt[c]++;
}
return ans;
}
LL countSmallest(Colors a) {
LL ans = 0;
FOREACH(pb, colcnt) {
if (!pb.second) continue;
Colors b = pb.first;
Colors brot = pb.first;
colcnt[b]--;
FORN(rot, 4) {
LL curans =
ans += multi * countfit(a, b, brot);
brot.rotate_left(1);
}
colcnt[b]++;
}
return ans;
}
int main() {
ios_base::sync_with_stdio(0);
SCi(N);
FORN(i, N) {
Colors c;
FORN(j, 4)
SCi(c.colors[j]);
c.normalize();
colcnt[c]++;
tiles.push_back(c);
}
LL ans = 0;
FORN(i, (int)tiles.size()) {
Colors a = tiles[i];
colcnt[a]--;
ans += countSmallest(a);
}
PRN(ans);
return 0;
}
|
a.cc: In function 'LL countSmallest(Colors)':
a.cc:289:20: error: 'multi' was not declared in this scope; did you mean 'multo'?
289 | ans += multi * countfit(a, b, brot);
| ^~~~~
| multo
|
s024547141
|
p03968
|
C++
|
#include <cstdio>
#include <set>
#include <vector>
using namespace std;
int nextInt() {
int x;
scanf("%d", &x);
return x;
}
const int N = 400;
int col[N][8];
long long hashes[N][4];
set<long long> any;
long long dp[16];
int ways[4];
long long calcHash(int a, int b, int c, int d) {
long long h = 0;
h = 1000 * h + a;
h = 1000 * h + b;
h = 1000 * h + c;
h = 1000 * h + d;
return h;
}
int main() {
int n = nextInt();
for (int i = 0; i < n; i++) {
for (int j = 0; j < 4; j++) {
col[i][j] = nextInt();
col[i][j + 4] = col[i][j];
}
for (int rot = 0; rot < 4; rot++) {
for (int j = 0; j < 4; j++) {
hashes[i][rot] = 1000 * hashes[i][rot] + col[i][(rot + j) % 4];
}
any.insert(hashes[i][rot]);
}
}
long long ans = 0;
for (int front = 0; front < n; front++) {
int a = col[front][0];
int b = col[front][1];
int c = col[front][2];
int d = col[front][3];
for (int back = front + 1; back < n; back++) {
rotLoop:
for (int rotBack = 0; rotBack < 4; rotBack++) {
int f = col[back][(rotBack + 0)];
int e = col[back][(rotBack + 1)];
int h = col[back][(rotBack + 2)];
int g = col[back][(rotBack + 3)];
long long h1 = calcHash(a, e, f, b);
long long h2 = calcHash(b, f, g, c);
long long h3 = calcHash(d, c, g, h);
long long h4 = calcHash(e, a, d, h);
vector<long long> hs = {h1, h2, h3, h4};
bool can = true;
for (int i = 0; i < 4; i++) {
if (any.count(s) == 0) {
can = false;
}
}
if (!can) {
continue;
}
for (int i = 0; i < 16; i++) {
dp[i] = 0;
}
dp[0] = 1;
for (int i = front + 1; i < n; i++) {
if (i == back) {
continue;
}
for (int j = 0; j < 4; j++) {
ways[j] = 0;
}
for (int bit = 0; bit < 4; bit++) {
for (int rot = 0; rot < 4; rot++) {
if (hashes[i][rot] == hs[bit]) {
++ways[bit];
}
}
}
for (int mask = 15; mask >= 0; mask--) {
if (dp[mask] == 0) {
continue;
}
for (int bit = 0; bit < 4; bit++) {
if ((mask & (1 << bit)) != 0) {
continue;
}
dp[mask | (1 << bit)] += dp[mask] * ways[bit];
}
}
}
ans += dp[15];
}
}
}
printf("%lld\n", ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:62:55: error: 's' was not declared in this scope
62 | if (any.count(s) == 0) {
| ^
|
s817057063
|
p03968
|
C++
|
#include <cstdio>
#include <set>
using namespace std;
int nextInt() {
int x;
scanf("%d", &x);
return x;
}
const int N = 400;
int col[N][8];
long long hash[N][4];
set<long long> any;
long long dp[16];
int ways[4];
long long calcHash(int a, int b, int c, int d) {
long long h = 0;
h = 1000 * h + a;
h = 1000 * h + b;
h = 1000 * h + c;
h = 1000 * h + d;
return h;
}
int main() {
int n = nextInt();
for (int i = 0; i < n; i++) {
for (int j = 0; j < 4; j++) {
col[i][j] = nextInt();
col[i][j + 4] = col[i][j];
}
for (int rot = 0; rot < 4; rot++) {
for (int j = 0; j < 4; j++) {
hash[i][rot] = 1000 * hash[i][rot] + col[i][(rot + j) % 4];
}
any.insert(hash[i][rot]);
}
}
long long ans = 0;
for (int front = 0; front < n; front++) {
int a = col[front][0];
int b = col[front][1];
int c = col[front][2];
int d = col[front][3];
for (int back = front + 1; back < n; back++) {
rotLoop:
for (int rotBack = 0; rotBack < 4; rotBack++) {
int f = col[back][(rotBack + 0)];
int e = col[back][(rotBack + 1)];
int h = col[back][(rotBack + 2)];
int g = col[back][(rotBack + 3)];
long long h1 = calcHash(a, e, f, b);
long long h2 = calcHash(b, f, g, c);
long long h3 = calcHash(d, c, g, h);
long long h4 = calcHash(e, a, d, h);
vector<long long> hs = {h1, h2, h3, h4};
bool can = true;
for (int i = 0; i < 4; i++) {
if (any.count(s) == 0) {
can = false;
}
}
if (!can) {
continue;
}
for (int i = 0; i < 16; i++) {
dp[i] = 0;
}
dp[0] = 1;
for (int i = front + 1; i < n; i++) {
if (i == back) {
continue;
}
for (int j = 0; j < 4; j++) {
ways[j] = 0;
}
for (int bit = 0; bit < 4; bit++) {
for (int rot = 0; rot < 4; rot++) {
if (hash[i][rot] == hs[bit]) {
++ways[bit];
}
}
}
for (int mask = 15; mask >= 0; mask--) {
if (dp[mask] == 0) {
continue;
}
for (int bit = 0; bit < 4; bit++) {
if ((mask & (1 << bit)) != 0) {
continue;
}
dp[mask | (1 << bit)] += dp[mask] * ways[bit];
}
}
}
ans += dp[15];
}
}
}
printf("%lld\n", ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:58:33: error: 'vector' was not declared in this scope
58 | vector<long long> hs = {h1, h2, h3, h4};
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <set>
+++ |+#include <vector>
3 | using namespace std;
a.cc:58:40: error: expected primary-expression before 'long'
58 | vector<long long> hs = {h1, h2, h3, h4};
| ^~~~
a.cc:61:55: error: 's' was not declared in this scope
61 | if (any.count(s) == 0) {
| ^
a.cc:81:77: error: 'hs' was not declared in this scope; did you mean 'h4'?
81 | if (hash[i][rot] == hs[bit]) {
| ^~
| h4
|
s714920334
|
p03968
|
C++
|
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
typedef pair<pair<int,int>, pair<int,int> > pt;
const int MOD = 1e9 + 7;
const int C = 1001;
unordered_map<ll,int> ma;
ll hsh(int a, int b, int c, int d)
{
ll x = ll(a)*ll(C)*ll(C)*ll(C);
x += ll(b)*ll(C)*ll(C);
x += ll(c)*ll(C);
x += d;
return x;
}
void cyc(int &a, int &b, int &c, int &d)
{
swap(a, b);
swap(a, c);
swap(a, d);
}
vector<pt> vec;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vec.resize(n);
for(int i = 0; i < n; i++)
{
cin >> vec[i].fi.fi >> vec[i].fi.se >> vec[i].se.fi >> vec[i].se.se;
}
for(int i = 0; i < n; i++)
{
int a = vec[i].fi.fi; int b = vec[i].fi.se;
int c = vec[i].se.fi; int d = vec[i].se.se;
ma[hsh(a,b,c,d)]++;
ma[hsh(b,c,d,a)]++;
ma[hsh(c,d,a,b)]++;
ma[hsh(d,a,b,c)]++;
}
ll ans = 0;
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(i == j) continue;
int xa, xb, xc, xd, ya, yb, yc, yd;
xa = vec[i].fi.fi; xb = vec[i].fi.se; xc = vec[i].se.fi; xd = vec[i].se.se;
ya = vec[j].fi.fi; yb = vec[j].fi.se; yc = vec[j].se.fi; yd = vec[j].se.se;
swap(xb,xd);
for(int k = 0; k < 4; k++)
{
int a,b,c,d;
a=xa,b=xb,c=xc,d=xd;
swap(b,d);
ma[hsh(a,b,c,d)]--;
ma[hsh(b,c,d,a)]--;
ma[hsh(c,d,a,b)]--;
ma[hsh(d,a,b,c)]--;
a=ya,b=yb,c=yc,d=yd;
ma[hsh(a,b,c,d)]--;
ma[hsh(b,c,d,a)]--;
ma[hsh(c,d,a,b)]--;
ma[hsh(d,a,b,c)]--;
ll h1 = hsh(ya,yd,xd,xa);
ll h2 = hsh(yd,yc,xc,xd);
ll h3 = hsh(yc,yb,xb,xc);
ll h4 = hsh(yb,ya,xa,xb);
//set<ll> ss;
//ss.insert(h1); ss.insert(h2); ss.insert(h3); ss.insert(h4);
unordered_map<ll,int> ss;
////cerr<<h1<<' '<<h2<<' '<<h3<<' '<<h4<<'\n';
ll tmp = 0;
////cerr<<w<<' '<<x<<' '<<y<<' '<<z<<'\n';
ll x1 = ma[h1];
ss.clear();
for(int z = 0; z < 4; z++)
{
cyc(ya,yd,xd,xa);
ss[hsh(ya,yd,xd,xa)]++;
}
for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
{
ma[it->fi] -= it->se;
}
//ma[w][h1]--; ma[w][h2]--; ma[w][h3]--; ma[w][h4]--;
ll x2 = ma[h2];
ss.clear();
for(int z = 0; z < 4; z++)
{
cyc(yd,yc,xc,xd);
ss[hsh(yd,yc,xc,xd)]++;
}
for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
{
ma[it->fi] -= it->se;
}
//ma[x][h2]--; ma[x][h1]--; ma[x][h3]--; ma[x][h4]--;
ll x3 = ma[h3];
ss.clear();
for(int z = 0; z < 4; z++)
{
cyc(yc,yb,xb,xc);
ss[hsh(yc,yb,xb,xc)]++;
}
for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
{
ma[it->fi] -= it->se;
}
//ma[y][h3]--; ma[y][h2]--; ma[y][h1]--; ma[y][h4]--;
ll x4 = ma[h4];
ss.clear();
for(int z = 0; z < 4; z++)
{
cyc(ya,yd,xd,xa);
ss[hsh(ya,yd,xd,xa)]++;
}
for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
{
ma[it->fi] += it->se;
}
//ma[w][h1]--; ma[w][h2]--; ma[w][h3]--; ma[w][h4]--;
ss.clear();
for(int z = 0; z < 4; z++)
{
cyc(yd,yc,xc,xd);
ss[hsh(yd,yc,xc,xd)]++;
}
for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
{
ma[it->fi] += it->se;
}
//ma[x][h2]--; ma[x][h1]--; ma[x][h3]--; ma[x][h4]--;
ss.clear();
for(int z = 0; z < 4; z++)
{
cyc(yc,yb,xb,xc);
ss[hsh(yc,yb,xb,xc)]++;
}
for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
{
ma[it->fi] += it->se;
}
//ma[w][h1]++; ma[x][h2]++; ma[y][h3]++;
//ma[w][h1]++; ma[w][h2]++; ma[w][h3]++; ma[w][h4]++;
//ma[x][h2]++; ma[x][h1]++; ma[x][h3]++; ma[x][h4]++;
//ma[y][h3]++; ma[y][h2]++; ma[y][h1]++; ma[y][h4]++;
x1=max(x1,0LL); x2=max(x2,0LL); x3=max(x3,0LL); x4 = max(x4,0LL);
tmp += (x1*x2*x3*x4);
/*
tmp*=ma[h1];
ma[h1]--;
tmp*=ma[h2];
ma[h2]--;
tmp*=ma[h3];
ma[h3]--;
tmp*=ma[h4];
ma[h1]++; ma[h2]++; ma[h3]++;
*/
//cerr<<i<<' '<<j<<' '<<xa<<' '<<xb<<' '<<xc<<' '<<xd<<' '<<ya<<' '<<yb<<' '<<yc<<' '<<yd<<' '<<tmp<<'\n';
ans += tmp;
a=xa,b=xb,c=xc,d=xd;
swap(b,d);
ma[hsh(a,b,c,d)]++;
ma[hsh(b,c,d,a)]++;
ma[hsh(c,d,a,b)]++;
ma[hsh(d,a,b,c)]++;
a=ya,b=yb,c=yc,d=yd;
ma[hsh(a,b,c,d)]++;
ma[hsh(b,c,d,a)]++;
ma[hsh(c,d,a,b)]++;
ma[hsh(d,a,b,c)]++;
cyc(ya,yb,yc,yd);
}
}
}
//assert(ans%6==0);
ans/=6;
cout << ans;
}
|
a.cc: In function 'int main()':
a.cc:108:80: error: conversion from 'std::unordered_map<long long int, int>::iterator' {aka 'std::__detail::_Insert_base<long long int, std::pair<const long long int, int>, std::allocator<std::pair<const long long int, int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} to non-scalar type 'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} requested
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
| ~~~~~~~~^~
a.cc:108:87: error: no match for 'operator!=' (operand types are 'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} and 'std::unordered_map<long long int, int>::iterator' {aka 'std::__detail::_Insert_base<long long int, std::pair<const long long int, int>, std::allocator<std::pair<const long long int, int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'})
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
| ~~ ^~ ~~~~~~~~
| | |
| | std::unordered_map<long long int, int>::iterator {aka std::__detail::_Insert_base<long long int, std::pair<const long long int, int>, std::allocator<std::pair<const long long int, int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator}
| std::map<long long int, int>::iterator {aka std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed:
a.cc:108:97: note: 'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
| ^
/usr/include/c++/14/bits/regex.h:1212: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>&)'
1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed:
a.cc:108:97: note: 'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
| ^
/usr/include/c++/14/bits/regex.h:1305: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>&)'
1305 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed:
a.cc:108:97: note: 'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
| ^
/usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed:
a.cc:108:97: note: 'std::unordered_map<long long int, int>::iterator' {aka 'std::__detail::_Insert_base<long long int, std::pair<const long long int, int>, std::allocator<std::pair<const long long int, int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
| ^
/usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1473 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed:
a.cc:108:97: note: 'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
| ^
/usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed:
a.cc:108:97: note: 'std::unordered_map<long long int, int>::iterator' {aka 'std::__detail::_Insert_base<long long int, std::pair<const long long int, int>, std::allocator<std::pair<const long long int, int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
| ^
/usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1647 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed:
a.cc:108:97: note: 'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
108 | for(map<ll,int>::iterator it = ss.begin(); it != ss.end(); it++)
|
|
s632449749
|
p03968
|
C++
|
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
inline int GetBit(int mask, int num) {
return (mask >> num) & 1;
}
int cFront[4];
int cBack[4];
inline bool CanLeft(int c0, int c1, int c2, int c3) {
return c0 == cBack[3] && c1 == cBack[2] && c2 == cFront[1] && c3 == cFront[0];
}
inline bool CanRight(int c0, int c1, int c2, int c3) {
return c0 == cFront[3] && c1 == cFront[2] && c2 == cBack[1] && c3 == cBack[0];
}
inline bool CanUp(int c0, int c1, int c2, int c3) {
return c0 == cFront[1] && c1 == cBack[2] && c2 == cBack[1] && c3 == cFront[2];
}
inline bool CanDown(int c0, int c1, int c2, int c3) {
return c0 == cBack[3] && c1 == cFront[0] && c2 == cFront[3] && c3 == cBack[0];
}
inline bool Can(int b, int c1, int c2, int c3, int c4) {
if (b == 0) {
return CanLeft(c1, c2, c3, c4);
} else if (b == 1) {
return CanRight(c1, c2, c3, c4);
} else if (b == 2) {
return CanUp(c1, c2, c3, c4);
} else {
return CanDown(c1, c2, c3, c4);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<vector<int>> colors(n, vector<int>(8));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 4; ++j) {
cin >> colors[i][j];
colors[i][j + 4] = colors[i][j];
}
}
/*
vector<vector<int>> bits(1 << 4);
for (int mask = 0; mask < (1 << 4); ++mask) {
for (int b = 0; b < 4; ++b) {
if (!GetBit(mask, b)) {
bits[mask].push_back(b);
}
}
}
*/
long long result[2][1 << 4];
int buffer[4];
long long glResult = 0;
for (int i = 0; i < n; ++i) {
for (int t = 0; t < 4; ++t) {
cFront[t] = colors[i][t];
}
for (int j = i + 1; j < n; ++j) {
for (int dj = 0; dj < 4; ++dj) {
for (int t = 0; t < 4; ++t) {
cBack[t] = colors[j][dj + t];
}
int curPtr = 0;
memset(result[curPtr], 0, sizeof(long long) * (1 << 4));
result[curPtr][0] = 1;
for (int k = i + 1; k < n; ++k) {
if (k == j) {
continue;
}
const int nxtPtr = 1 - curPtr;
for (int t = 0; t < (1 << 4); ++t) {
result[nxtPtr][t] = result[curPtr][t];
}
memset(buffer, 0, sizeof(int) * 4);
for (int dk = 0; dk < 4; ++dk) {
/*
buffer[0] += CanLeft(colors[k][dk], colors[k][dk + 1], colors[k][dk + 2], colors[k][dk + 3]);
buffer[1] += CanRight(colors[k][dk], colors[k][dk + 1], colors[k][dk + 2], colors[k][dk + 3]);
buffer[2] += CanUp(colors[k][dk], colors[k][dk + 1], colors[k][dk + 2], colors[k][dk + 3]);
buffer[3] += CanDown(colors[k][dk], colors[k][dk + 1], colors[k][dk + 2], colors[k][dk + 3]);
*/
for (int b = 0; b < 4; ++b) {
if (Can(b, colors[k][dk], colors[k][dk + 1], colors[k][dk + 2], colors[k][dk + 3])) {
++buffer[b];
}
}
}
for (int mask = 0; mask < (1 << 4); ++mask) {
for (int b = 0; b < 4; ++b) {
if (!GetBit(mask, b)) {
result[nxtPtr][mask + (1 << b)] += buffer[b] * result[curPtr][mask];
}
}
}
curPtr = nxtPtr;
}
glResult += result[curPtr][(1 << 4) - 1];
}
}
}
cout << glResult << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:85:17: error: 'memset' was not declared in this scope
85 | memset(result[curPtr], 0, sizeof(long long) * (1 << 4));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <algorithm>
+++ |+#include <cstring>
4 | #include <string>
|
s449589369
|
p03969
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
const int N = 105, MOD = 1e9 + 7;
int n, m, k, fac[N << 1], ifac[N << 1];
int fpow(int a, int m) {
int ans = 1;
for(; m; m >>= 1) {
if(m & 1) ans = ans * 1ll * a % MOD;
a = a * 1ll * a % MOD;
}
return ans;
}
struct Edge {
int nxt, v;
}e[N << 1];
int bccno[N], bcc_cnt,siz_e[N], siz_p[N], dfs_clock, low[N], pre[N], head[N], cnt, top;
pair<int, int> stk[N];
void add(int u, int v) {
e[++cnt] = (Edge){head[u], v}, head[u] = cnt;
e[++cnt] = (Edge){head[v], u}, head[v] = cnt;
}
void dfs(int u, int fa) {
low[u] = pre[u] = ++dfs_clock;
for(int i = head[u]; ~i; i = e[i].nxt) {
int v = e[i].v;
if(v == fa) continue;
if(!pre[v]) {
stk[++top] = make_pair(u, v);
dfs(v, u);
low[u] = min(low[u], low[v]);
if(low[v] >= pre[u]) {
bcc_cnt++;
while(523) {
int x = stk[top].first, y = stk[top].second;
top--;
siz_e[bcc_cnt]++;
if(bccno[x] != bcc_cnt) {bccno[x] = bcc_cnt; siz_p[bcc_cnt]++;}
if(bccno[y] != bcc_cnt) {bccno[y] = bcc_cnt; siz_p[bcc_cnt]++;}
if(x == u && y == v) break;
}
}
}
else if(pre[v] < pre[u]) {stk[++top] = make_pair(u, v); low[u] = min(low[u], pre[v]);}
}
}
int C(int n, int m) {
return fac[n] * 1ll * ifac[m] % MOD * ifac[n - m] % MOD;
}
int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
int main() {
memset(head, -1, sizeof head);
scanf("%lld %lld %lld", &n, &m, &k);
fac[0] = ifac[0] = ifac[1] = 1;
for (int i = 1; i <= m + k; ++i) fac[i] = fac[i - 1] * 1ll * i % MOD;
for (int i = 2; i <= m + k; ++i) ifac[i] = (MOD - MOD / i) * 1ll * ifac[MOD % i] % MOD;
for (int i = 2; i <= m + k; ++i) ifac[i] = ifac[i - 1] * 1ll * ifac[i] % MOD;
for(int i = 1; i <= m; i++) {
int u, v;
scanf("%lld %lld", &u, &v);
add(u, v);
}
for(int i = 1; i <= n; i++) {
if(!pre[i]) dfs(i, 0);
}
int ans1 = 1, ans2 = 1, ans3 = 1;
for(int i = 1; i <= bcc_cnt; i++) {
if(siz_e[i] == 1) ans1 = ans1 * 1ll * k % MOD;
else if(siz_e[i] == siz_p[i]) {
int sum = 0;
for(int j = 1; j <= siz_e[i]; j++) {
sum += fpow(k, gcd(siz_p[i], j));
if(sum >= MOD) sum -= MOD;
}
ans2 = ans2 * 1ll * sum * fpow(siz_e[i], MOD - 2) % MOD;
} else ans3 = ans3 * 1ll * C(siz_e[i] + k - 1, k - 1) % MOD;
}
printf("%lld\n", ans1 * 1ll * ans2 % MOD * ans3 % MOD);
return 0;
}
|
cc1plus: error: '::main' must return 'int'
|
s263184475
|
p03969
|
C++
|
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
typedef unsigned long long ull;
const int inf=1039074182;
const int mod=1e9+7;
using namespace std;
int n,m,k;
vector <pair<int,int> > vec[55];
bool AP[55];
int time=0;
int disc[55];
int low[55];
stack <int> stk;
vector <vector<int> > BiComponent;
pair<int,int> edge[105];
bool findBC;
bool visitEdge[105];
namespace combinatorics
{
int *fac;
int *ifac;
int mod;
inline int add(int a,int b)
{
return (a+b)%mod;
}
inline int minus(int a,int b)
{
return (a-b+mod)%mod;
}
inline int multiply(int a,int b)
{
return (1LL*a*b)%mod;
}
inline int fastpow(int basic,int x)
{
int res=1;
while(x)
{
if(x&1) res=multiply(res,basic);
basic=multiply(basic,basic);
x>>=1;
}
return res;
}
inline int inv(int x)
{
return fastpow(x,mod-2);
}
void init(int n,int tmod)
{
mod=tmod;
fac=new int[n+5];
ifac=new int[n+5];
fac[0]=1;
for(int i=1;i<=n;i++)
{
fac[i]=multiply(fac[i-1],i);
}
ifac[n]=inv(fac[n]);
for(int i=n-1;i>=0;i--)
{
ifac[i]=multiply(ifac[i+1],i+1);
}
}
inline int C(int n,int m)
{
return multiply(multiply(fac[n],ifac[m]),ifac[n-m]);
}
inline int Cat(int x)
{
return multiply(C(x*2,x),inv(x+1));
}
};
using namespace combinatorics;
int calcS(int n)
{
int res=fastpow(k,n);
for(int i=1;i<n;i++)
{
if(n%i) res=add(res,k);else res=add(res,fastpow(k,i));
}
return multiply(res,inv(n));
}
int calcC(int n)
{
return C(n+k-1,k-1);
}
bool dfs(int x,int par=-1)
{
low[x]=disc[x]=time++;
int child=0;
for(auto u:vec[x])
{
if(u.first==par) continue;
if(!visitEdge[u.second]) stk.push(u.second);
visitEdge[u.second]=true;
if(disc[u.first]==-1)
{
child++;
dfs(u.first,x);
if((par==-1 && child>=2) || (par!=-1 && low[u.first]>=disc[x]))
{
AP[x]=true;
vector <int> edge;
findBC=true;
while(!stk.empty())
{
edge.push_back(stk.top());
stk.pop();
if(edge.back()==u.second) break;
}
BiComponent.push_back(edge);
}
}
low[x]=min(low[x],low[u.first]);
}
}
int main()
{
// freopen("input.txt","r",stdin);
init(200,1e9+7);
cin>>n>>m>>k;
int x,y;
for(int i=0;i<m;i++)
{
scanf("%d%d",&x,&y);
x--;
y--;
vec[x].push_back(mp(y,i));
vec[y].push_back(mp(x,i));
edge[i].first=x;
edge[i].second=y;
}
memset(disc,-1,sizeof(disc));
for(int i=0;i<n;i++)
{
if(disc[i]==-1)
{
findBC=false;
dfs(i);
if(stk.empty()) continue;
vector <int> temp;
while(!stk.empty())
{
temp.push_back(stk.top());
stk.pop();
}
BiComponent.push_back(temp);
}
}
vector <int> temp;
int res=1;
for(auto &x:BiComponent)
{
temp.clear();
for(auto u:x)
{
temp.push_back(edge[u].first);
temp.push_back(edge[u].second);
}
sort(all(temp));
temp.erase(unique(all(temp)),temp.end());
// cout<<temp.size()<<' '<<x.size()<<endl;
if(temp.size()==x.size())
{
res=multiply(res,calcS(x.size()));
}
else if(x.size()==1)
{
res=multiply(res,k);
}
else
{
res=multiply(res,calcC(x.size()));
}
}
cout<<res<<endl;
return 0;
}
|
a.cc:28:5: error: 'int time' redeclared as different kind of entity
28 | int time=0;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'bool dfs(int, int)':
a.cc:113:24: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
113 | low[x]=disc[x]=time++;
| ^~~~
a.cc:113:28: error: lvalue required as increment operand
113 | low[x]=disc[x]=time++;
| ^~
a.cc:140:1: warning: no return statement in function returning non-void [-Wreturn-type]
140 | }
| ^
|
s821503605
|
p03969
|
C++
|
11 12 48
3 1
8 2
4 9
5 4
1 6
2 9
8 3
10 8
4 10
8 6
11 7
1 8
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 11 12 48
| ^~
|
s062746950
|
p03969
|
C++
|
//by xxj
//I love 7 sea k fall
#include<bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define lowbit(x) x&-x
const int inf=1e9+7;
const double eps=1e-10;
const ll linf=1e18+7;
const ll hh=523;
const int mod=1e9+7;
inline int read(){
int x=0;char ch=getchar();
while(ch<'0'||ch>'9')ch=getchar();
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x;
}
ll pow(ll a,int c){
ll re=1;
while (c){
if (c&1){
re=1ll*re*a%mod;
}
a=1ll*a*a%mod;
c>>=1;
}
return re;
}
struct Edge{
int next,to,bh;
}edge[207];
int head[207],len=0;;
void add(int x,int y,int bh){
edge[len].next=head[x];
edge[len].to=y;
edge[len].bh=bh;
head[x]=len++;
edge[len].next=head[y];
edge[len].to=x;
edge[len].bh=bh;
head[y]=len++;
}
ll ans=1;
int tot=1,cnt=0,num=0;
int dfn[57],low[57];
bool visited[207];
bool bridge[207],used[57];
ll h1[107][107],dp[107][107],hn[107][107];
ll jc[107],njc[107];
vector<int> hve[107];
bool f[107][107];
int n,m,k;
vector<int> findit;
ll calc(int e,int c){
ll re=pow(c,e);
for (int i=1;i<e;i++){
re=(re+pow(c,__gcd(i,e)))%mod;
}
re=1ll*re*pow(e,mod-2)%mod;
return re;
}
ll C(int i,int j){
return 1ll*jc[j]*njc[i]%mod*njc[j-i]%mod;
}
void init(){
// cout<<pow(3,2)<<endl;
jc[0]=1;
for (int i=1;i<=k;i++){
jc[i]=1ll*jc[i-1]*i%mod;
}
njc[k]=pow(jc[k],mod-2);
for (int i=k-1;i>=0;i--){
njc[i]=1ll*njc[i+1]*(i+1)%mod;
}
for (int i=1;i<=m;i++){
for (int j=1;j<=k;j++){
h1[i][j]=calc(i,j);
}
}
for (int i=1;i<=k;i++){
dp[1][i]=i;
}
for (int i=1;i<=m;i++){
dp[i][1]=1;
}
for (int i=2;i<=m;i++){
for (int j=2;j<=k;j++){
for (int z=1;;z++){
if (i-z<j-1){
break;
}
dp[i][j]=(dp[i][j]+dp[i-z][j-1])%mod;
}
}
}
for (int i=1;i<=m;i++){
for (int j=1;j<=k;j++){
for (int z=1;z<=j;z++){
hn[i][j]=(hn[i][j]+1ll*C(z,j)*dp[i][z]%mod)%mod;
}
}
}
}
void tarjan(int v,int p){
dfn[v]=tot;
hve[tot].push_back(v);
// cout<<tot<<':'<<v+1<<endl;
f[tot][v]=true;
low[v]=tot++;
for (int i=head[v];i!=-1;i=edge[i].next){
int u=edge[i].to;
if (!dfn[u]){
tarjan(u,i);
low[v]=min(low[v],low[u]);
if (low[u]>dfn[v]){
bridge[i]=true;
bridge[i^1]=true;
cnt++;
}
}
else if (p==-1 || i!=(p^1)){
low[v]=min(low[v],dfn[u]);
}
}
if (!f[low[v]][v]){
hve[low[v]].push_back(v);
// cout<<low[v]<<':'<<v+1<<endl;
f[low[v]][v]=true;
}
}
void dfs(int v,int c){
used[v]=true;
// cout<<v<<endl;
for (int i=head[v];i!=-1;i=edge[i].next){
int u=edge[i].to;
if (!f[c][u] || visited[i]){
continue;
}
num++;
visited[i]=true;
visited[i^1]=true;
if (used[u]){
cnt++;
continue;
}
dfs(u,c);
}
}
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
scanf("%d%d%d",&n,&m,&k);
init();
// cout<<h1[4][2]<<endl;
memset(head,-1,sizeof(head));
for (int i=0;i<m;i++){
int x,y;
scanf("%d%d",&x,&y);
x--;
y--;
add(x,y,i);
}
for (int i=0;i<n;i++){
if (!dfn[i]){
tarjan(i,-1);
}
}
// puts("");
// for (int i=0;i<n;i++){
// cout<<f[1][i]<<' ';
// }
// puts("");
ans=pow(k,cnt);
// cout<<cnt<<endl;
for (int i=1;i<tot;i++){
if (hve[i].size()==1){
continue;
}
memset(used,false,sizeof(used));
cnt=0;
num=0;
// puts("dfsbegin");
dfs(hve[i][0],i);
// cout<<cnt<<' '<<num<<endl;
// puts("dfsend");
if (cnt==1){
ans=1ll*ans*h1[num][k]%mod;
}
else{
ans=1ll*ans*hn[num][k]%mod;
}
}
printf("%lld\n",ans);
return 0;
}
/*
input:
*/
|
a.cc: In function 'long long int calc(int, int)':
a.cc:61:42: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const int' to binary 'operator%'
61 | re=(re+pow(c,__gcd(i,e)))%mod;
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
| | |
| | const int
| __gnu_cxx::__promote<double>::__type {aka double}
a.cc:63:31: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const int' to binary 'operator%'
63 | re=1ll*re*pow(e,mod-2)%mod;
| ~~~~~~~~~~~~~~~~~~~^~~~
| | |
| | const int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s617083797
|
p03969
|
C++
|
#include <>bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MX=1e3+7;
const int Md=1e9+7;
int n,m,K;
LL fac[MX],inv[MX];
LL ans=1;
void init()
{
int n=1e3;
fac[0]=fac[1]=inv[0]=inv[1]=1;
for(int i=2; i<=n; i++)
{
fac[i]=fac[i-1]*i%Md;
inv[i]=(Md-Md/i)*inv[Md%i]%Md;
}
for(int i=2; i<=n; i++) inv[i]=inv[i]*inv[i-1]%Md;
}
LL qpow(LL a, LL n)
{
LL ret=1;
while(n)
{
if(n&1) ret=ret*a%Md;
a=a*a%Md; n>>=1;
}
return ret;
}
int gcd(int x,int y)
{
return y?gcd(y,x%y):x;
}
LL polya(int m)
{
LL ret=0;
for(int i = 1; i <= m; i++)
{
ret+=qpow(K,gcd(i,m)); ret%=Md;
}
return (ret*qpow(m,Md-2))%Md;
}
LL C(int n, int m)
{
if(n<m) return 0;
return fac[n]*inv[m]%Md*inv[n-m]%Md;
}
struct edge
{
int v; bool vis;
edge *nxt,*rev;
}*con[MX],*stc[MX];
int dfn[MX],low[MX],tim,top;
bool vis[MX];
void add(int u, int v)
{
edge *p=new edge;
p->v=v; p->vis=0; p->nxt=con[u]; con[u]=p;
}
void get_rev(int u, int v)
{
con[u]->rev=con[v]; con[v]->rev=con[u];
}
void tarjan(int u)
{
dfn[u]=low[u]=++tim;
for(edge *p = con[u]; p; p = p->nxt)
{
if(p->vis || p->rev->vis) continue;
stc[++top]=p;
p->vis=p->rev->vis=1;
if(!dfn[p->v])
{
tarjan(p->v);
low[u]=min(low[u],low[p->v]);
if(low[p->v]>=dfn[u])
{
bool cir=1;//判断一个环的点双联通分量与多重环的点双联通分量
int cnt=0;
for(int i=top; stc[i+1]!=p; --i,++cnt)
if (vis[stc[i]->v]) cir=0;
else vis[stc[i]->v]=1;
for(; stc[top+1]!=p; --top) vis[stc[top]->v]=0;
if(cir) ans=(ans*polya(cnt))%Md;
else ans=(ans*C(cnt+K-1,K-1))%Md;
ans%=Md;
}
}
else low[u]=min(low[u],dfn[p->v]);
}
}
int main()
{
init();
scanf("%d%d%d",&n,&m,&K);
for(int i = 1,u,v; i <= m; i++)
{
scanf("%d%d",&u,&v);
add(u,v); add(v,u); get_rev(u,v);
}
for(int i=1; i<=n; i++)
if(!dfn[i]) tarjan(i);
printf("%lld\n",ans);
return 0;
}
|
a.cc:1:16: warning: extra tokens at end of #include directive
1 | #include <>bits/stdc++.h>
| ^
a.cc:1:10: fatal error: >bit: No such file or directory
1 | #include <>bits/stdc++.h>
| ^~~~~~
compilation terminated.
|
s737684582
|
p03969
|
C++
|
11 12 48
3 1
8 2
4 9
5 4
1 6
2 9
8 3
10 8
4 10
8 6
11 7
1 8
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 11 12 48
| ^~
|
s052752129
|
p03969
|
C++
|
11 12 48
3 1
8 2
4 9
5 4
1 6
2 9
8 3
10 8
4 10
8 6
11 7
1 8
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 11 12 48
| ^~
|
s580452041
|
p03969
|
C++
|
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<stack>
using namespace std;
typedef long long ll;
const ll N=205;
const ll mod=1e9+7;
vector<int>edge[N];
ll dfn[N],low[N],tot;
struct node{
int u,v,nxt;
}edge[N];
int head[N],mcnt;
void add_edge(int u,int v){
mcnt++;
edge[mcnt].u=u;
edge[mcnt].v=v;
edge[mcnt].nxt=head[u];
head[u]=mcnt;
}
int s[N],top;
ll scc[N],sccc;
bool vis[N];
ll p[N];
bool vis[N];
ll n,m,k;
ll gcd(ll x,ll y){
ll t;
while(y){
t=x%y;
x=y;
y=t;
}
return x;
}
ll ksm(ll x,ll y){
ll res=1;
while(y){
if(y&1)
res=(res*x)%mod;
x=(x*x)%mod;
y>>=1;
}
return res;
}
ll polya(ll x){
ll res=0;
for(int i=1;i<=x;i++)
res+=ksm(k,gcd(x,i)),res%=mod;
res*=ksm(x,mod-2);
res%=mod;
return res;
}
ll u1[N],v1[N];
ll fact[N+1],inv[N+1];
ll ans=1;
void pre(){
fact[0]=1;
for(int i=1;i<=N;i++)
fact[i]=(fact[i-1]*i)%mod;
inv[N]=ksm(fact[N],mod-2);
for(int i=N-1;i>=1;i--)
inv[i]=(inv[i+1]*(i+1))%mod;
inv[0]=1;
}
ll C(ll x,ll y){
return fact[x]*inv[y]%mod*inv[x-y]%mod;
}
void dfs(ll u,ll fa){
tot++;
dfn[u]=low[u]=tot;
s.push(u);
for(int i=head[u];i;i=edge[i].nxt){
ll v=edge[i].v;
if(v==fa)
continue ;
if(!dfn[v]){
s.push(i);
dfs(v,u);
low[u]=min(low[u],low[v]);
if(low[v]>=dfn[u]){
bool cir=1;
int cnt=0;
ll sum=0;
int x;
int sz=0;
for(int j=top;s[j+1]!=i;sz++,j--)
if(vis[edge[s[j]].v])
cir=0;
else
vis[edge[s[j]].v]=1;
if(cir){
ans*=polya(sz);
ans%=mod;
}
else{
ans*=C(sz+k-1,k-1);
ans%=mod;
}
while(s[top+1]!=i){
vis[s[top].v]=0;
top--;
}
}
}
else
low[u]=min(low[u],dfn[v]);
}
}
int main()
{
scanf("%lld%lld%lld",&n,&m,&k);
for(ll i=1;i<=m;i++){
ll u,v;
scanf("%lld%lld",&u,&v);
edge[u].push_back(v);
edge[v].push_back(u);
u1[i]=u;
v1[i]=v;
}
pre();
for(ll i=1;i<=n;i++)
if(!dfn[i])
dfs(i,-1);
printf("%lld\n",ans);
}
|
a.cc:14:2: error: conflicting declaration 'node edge [205]'
14 | }edge[N];
| ^~~~
a.cc:10:12: note: previous declaration as 'std::vector<int> edge [205]'
10 | vector<int>edge[N];
| ^~~~
a.cc: In function 'void add_edge(int, int)':
a.cc:18:16: error: 'class std::vector<int>' has no member named 'u'
18 | edge[mcnt].u=u;
| ^
a.cc:19:16: error: 'class std::vector<int>' has no member named 'v'
19 | edge[mcnt].v=v;
| ^
a.cc:20:16: error: 'class std::vector<int>' has no member named 'nxt'
20 | edge[mcnt].nxt=head[u];
| ^~~
a.cc: At global scope:
a.cc:27:6: error: redefinition of 'bool vis [205]'
27 | bool vis[N];
| ^~~
a.cc:25:6: note: 'bool vis [205]' previously declared here
25 | bool vis[N];
| ^~~
a.cc: In function 'void dfs(ll, ll)':
a.cc:74:7: error: request for member 'push' in 's', which is of non-class type 'int [205]'
74 | s.push(u);
| ^~~~
a.cc:75:35: error: 'class std::vector<int>' has no member named 'nxt'
75 | for(int i=head[u];i;i=edge[i].nxt){
| ^~~
a.cc:76:22: error: 'class std::vector<int>' has no member named 'v'
76 | ll v=edge[i].v;
| ^
a.cc:80:15: error: request for member 'push' in 's', which is of non-class type 'int [205]'
80 | s.push(i);
| ^~~~
a.cc:90:39: error: 'class std::vector<int>' has no member named 'v'
90 | if(vis[edge[s[j]].v])
| ^
a.cc:93:40: error: 'class std::vector<int>' has no member named 'v'
93 | vis[edge[s[j]].v]=1;
| ^
a.cc:103:32: error: request for member 'v' in 's[top]', which is of non-class type 'int'
103 | vis[s[top].v]=0;
| ^
|
s065496229
|
p03969
|
C++
|
lude<bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod = 1e9 + 7;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll extgcd(ll a, ll b, ll &x, ll &y) { ll d; return b == 0 ? (x = 1, y = 0, a) : (d = extgcd(b, a % b, y, x), y -= a / b * x, d); }
ll modinv(ll a, ll mod = 1e9 + 7) { ll x = 0, y = 0; extgcd(a, mod, x, y); return (x + mod) % mod; }
ll modpow(ll a, ll b, ll mod = 1e9 + 7) { ll r = 1; while(b) { if(b & 1) r = r * a % mod; a = a * a % mod; b >>= 1; } return r; }
// #undef DEBUG
// #define DEBUG
/// {{{ DEBUG --- ///
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { if(&o == &cerr) { o << '{'; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; } else { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); } return o; }
#ifdef DEBUG
#define dump(...) (cerr<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n")
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
#else
#define dump(...)
#endif
/// }}}--- ///
vector<int> g[50];
int low[50], ord[50], id = 0;
int used[50];
// int isArticulation[50];
// int used2[50][50];
vector< vector< pair<int, int> > > bc;
vector< pair<int, int> > tmp;
void dfs(int i, int p = -1) {
low[i] = ord[i] = id++;
used[i] = 1;
for(int j : g[i]) if(j != p) {
pair<int, int> e(min(i, j), max(i, j));
if(used[j]) {
if(ord[i] > ord[j]) tmp.emplace_back(e);
low[i] = min(low[i], ord[j]);
} else {
tmp.emplace_back(e);
dfs(j, i);
low[i] = min(low[i], low[j]);
if(low[j] >= ord[i]) {
bc.push_back({});
while(1) {
auto ne = tmp.back();
bc.back().emplace_back(ne);
tmp.pop_back();
if(e == ne) break;
}
}
}
}
}
ll fact[201], inv[201];
ll C(ll n, ll r) {
if(n < r) return 0;
return fact[n] * inv[r] % mod * inv[n - r] % mod;
}
int main() {
ios::sync_with_stdio(false), cin.tie(0);
fact[0] = 1;
for(int i = 1; i <= 200; i++) fact[i] = fact[i - 1] * i % mod;
inv[200] = modinv(fact[200]);
for(int i = 199; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % mod;
int n, m, k; cin >> n >> m >> k;
for(int i = 0; i < m; i++) {
int a, b; cin >> a >> b;
a--; b--;
g[a].emplace_back(b);
g[b].emplace_back(a);
}
for(int i = 0; i < n; i++) if(!used[i]) dfs(i);
ll ans = 1;
for(auto es : bc) {
set<int> nums; int edge = es.size();
for(auto e : es) {
nums.emplace(e.first);
nums.emplace(e.second);
}
int num = nums.size();
if(num <= 1) {
} else if(num == 2) {
ans = ans * k % mod;
} else {
if(num == edge) {
ll res = 0;
for(int j = 1; j <= edge; j++) res += modpow(k, gcd(j, edge), mod);
res = res % mod * modinv(edge, mod) % mod;
ans = res * ans % mod;
} else {
ans = C(k + edge - 1, edge) % mod * ans % mod;
}
}
}
cout << ans << endl;
}
|
a.cc:1:1: error: 'lude' does not name a type
1 | lude<bits/stdc++.h>
| ^~~~
a.cc:16:23: error: 'ostream' does not name a type
16 | template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { if(&o == &cerr) { o << '{'; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; } else { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); } return o; }
| ^~~~~~~
a.cc:27:1: error: 'vector' does not name a type
27 | vector<int> g[50];
| ^~~~~~
a.cc:32:1: error: 'vector' does not name a type
32 | vector< vector< pair<int, int> > > bc;
| ^~~~~~
a.cc:33:1: error: 'vector' does not name a type
33 | vector< pair<int, int> > tmp;
| ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:38:15: error: 'g' was not declared in this scope
38 | for(int j : g[i]) if(j != p) {
| ^
a.cc:39:5: error: 'pair' was not declared in this scope
39 | pair<int, int> e(min(i, j), max(i, j));
| ^~~~
a.cc:39:10: error: expected primary-expression before 'int'
39 | pair<int, int> e(min(i, j), max(i, j));
| ^~~
a.cc:41:27: error: 'tmp' was not declared in this scope
41 | if(ord[i] > ord[j]) tmp.emplace_back(e);
| ^~~
a.cc:41:44: error: 'e' was not declared in this scope
41 | if(ord[i] > ord[j]) tmp.emplace_back(e);
| ^
a.cc:42:16: error: 'min' was not declared in this scope
42 | low[i] = min(low[i], ord[j]);
| ^~~
a.cc:44:7: error: 'tmp' was not declared in this scope
44 | tmp.emplace_back(e);
| ^~~
a.cc:44:24: error: 'e' was not declared in this scope
44 | tmp.emplace_back(e);
| ^
a.cc:46:16: error: 'min' was not declared in this scope
46 | low[i] = min(low[i], low[j]);
| ^~~
a.cc:48:9: error: 'bc' was not declared in this scope
48 | bc.push_back({});
| ^~
a.cc: In function 'int main()':
a.cc:67:3: error: 'ios' has not been declared
67 | ios::sync_with_stdio(false), cin.tie(0);
| ^~~
a.cc:67:32: error: 'cin' was not declared in this scope
67 | ios::sync_with_stdio(false), cin.tie(0);
| ^~~
a.cc:76:5: error: 'g' was not declared in this scope
76 | g[a].emplace_back(b);
| ^
a.cc:81:17: error: 'bc' was not declared in this scope
81 | for(auto es : bc) {
| ^~
a.cc:82:5: error: 'set' was not declared in this scope
82 | set<int> nums; int edge = es.size();
| ^~~
a.cc:82:9: error: expected primary-expression before 'int'
82 | set<int> nums; int edge = es.size();
| ^~~
a.cc:84:7: error: 'nums' was not declared in this scope
84 | nums.emplace(e.first);
| ^~~~
a.cc:87:15: error: 'nums' was not declared in this scope; did you mean 'num'?
87 | int num = nums.size();
| ^~~~
| num
a.cc:102:3: error: 'cout' was not declared in this scope
102 | cout << ans << endl;
| ^~~~
a.cc:102:18: error: 'endl' was not declared in this scope
102 | cout << ans << endl;
| ^~~~
|
s462727892
|
p03969
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstring>
#define NDEBUG
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
T i=0;char c;
while(!isdigit(c=getchar())&&c!='-');
bool flag=c=='-';
flag?c=getchar():0;
while(i=i*10-'0'+c,isdigit(c=getchar()));
return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int O=1000000007;
int gcd(int a,int b){
return b?gcd(b,a%b):a;
}
inline int fpow(int x,int n){
int a=1;
for(;n;n>>=1,x=(lint)x*x%O){
if(n&1){
a=(lint)a*x%O;
}
}
return a;
}
inline int inv(int x){
return fpow(x,O-2);
}
const int N=210;
int c[N][N];
int k,f[N],g[N],pw[N],ans=1;
namespace G{
const int N=55,E=110*2;
int to[E],bro[E],head[N],e=0;
int dfn[N],tim=0;
int efa[E],esize[E],estat[E];
int estk[N],ss=0;
inline void init(){
memset(head,-1,sizeof(head));
memset(dfn,0,sizeof(dfn));
memset(efa,0,sizeof(efa));
memset(estat,0,sizeof(estat));
}
inline void ae(int u,int v){
to[e]=v,bro[e]=head[u],esize[e]=1,head[u]=e++;
}
inline void add(int u,int v){
ae(u,v),ae(v,u);
}
int root(int x){
return efa[x]?efa[x]=root(efa[x]):x;
}
void dfs(int x,int fa){
dfn[x]=++tim;
for(int i=head[x],v;~i;i=bro[i]){
if((v=to[i])!=fa){
if(dfn[v]==0){
estk[ss++]=i;
ans=(lint)ans*k%O;
dfs(v,x);
if(stk[ss-1]==i){
ss--;
}
}else if(dfn[v]<dfn[x]){
int last=i,e,stat=1;
do{
e=estk[--ss];
if(estat[e]){
stat=2;
ans=(lint)ans*inv((estat[e]==1?f:g)[esize[e]])%O;
}else{
ans=(lint)ans*inv(k)%O;
}
efa[last]=e,esize[e]+=esize[last],last=e;
}while(dfn[v]<dfn[to[e^1]]);
estat[e]=stat;
estk[ss++]=e;
ans=(lint)ans*(stat==1?f:g)[esize[e]]%O;
}
}
}
}
}
inline void gmath(int n,int k){
pw[0]=1;
for(int i=1;i<=n;i++){
pw[i]=(lint)pw[i-1]*k%O;
}
for(int i=1;i<=n;i++){
lint tmp=0;
for(int j=0;j<i;j++){
tmp+=pw[gcd(i,j)];
}
f[i]=tmp%O*inv(i)%O;
}
memset(c,0,sizeof(c));
for(int i=0,ti=n+k;i<=ti;i++){
c[i][0]=1;
for(int j=1;j<=i;j++){
c[i][j]=(c[i-1][j-1]+c[i-1][j])%O;
}
}
for(int i=1;i<=n;i++){
g[i]=c[i+k-1][k-1];
}
}
int main(){
int n=ni,m=ni;
G::init();
gmath(m,k=ni);
for(int i=1;i<=m;G::add(ni,ni),i++);
for(int i=1;i<=n;i++){
if(G::dfn[i]==0){
G::dfs(i,0);
}
}
printf("%d\n",ans);
return 0;
}
|
a.cc: In function 'void G::dfs(int, int)':
a.cc:69:44: error: 'stk' was not declared in this scope; did you mean 'estk'?
69 | if(stk[ss-1]==i){
| ^~~
| estk
|
s880524497
|
p03969
|
C++
|
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define Re return
#define In inline
#define St static
#define inc(l, i, r) for(i=l; i<r; ++i)
#define dec(l, i, r) for(i=r; i>l; --i)
const int mxn=1<<8; const ll p=1000000007;
int n, m, k, h[mxn]; ll ans=1, c[mxn][mxn];
struct edge{int v, o;} e[mxn];
In void aE(int u, int v)
{
St int tot=1;
e[++tot]=(edge){v, u[h]}, u[h]=tot;
}
#define forG for(i=u[h]; v=i[e].v; i=i[e].o)
In int gcd(int a, int b)
{
for(;b; swap(a, b))
a%=b;
Re a;
}
In ll dP(ll a, ll b)
{
St ll r;
// printf("a: %d\nb: %d\n", a, b);
for(r=1; b; a=a*a%p, b>>=1)
b&1? r=r*a%p: 0;
// printf("a^b: %d\n", r);
Re r;
}
int cnt, bel[mxn];
In int chk(int u){Re bel[u]!=cnt? bel[u]=cnt, 1: 0;}
void Tar(int u, int w)
{
St int tim, DFN[mxn], low[mxn], st[mxn], t, st2[mxn];
if(DFN[u]) Re;
int i, j, t2, r, v; DFN[u]=low[u]=++tim;
forG
if(DFN[v])
{
if(v!=w && DFN[v]<DFN[u])
low[u]=min(low[u], DFN[v]), st[t++]=i;
}
else
{
st[t++]=i, Tar(v, u), low[u]=min(low[u], low[v]);
if(low[v]>=DFN[u])
{
for(++cnt, r=t2=0; st[t]!=i; ++t2)
{
--t;
// printf("v: %d\n", st[t]);
r+=chk(st[t][e].v)+chk(e[st[t]^1].v);
}
// printf("r: %d\n", r);
if(t2<r) ans=ans*k%p;
else if(r==t2)
{
r=0;
inc(1, j, t2+1)
r=(r+dP(k, gcd(t2, j)))%p;
// printf("R: %d\n", r);
ans=ans*r%p*dP(t2, p-2)%p;
// printf("1 == %d\n", t2*dP(t2, p-2)%p);
}
else
ans=ans*c[t2+k-1][k-1]%p;
// printf("A: %lld\n", ans);
}
}
}
int main()
{
int i, j, x;
scanf("%d%d%d", &n, &m, &k);
inc(0, i, m)
scanf("%d%d", &j, &x),
aE(j, x), aE(x, j);
inc(0, i, mxn)
c[i][0]=1;
inc(1, i, mxn)
inc(1, j, i+1)
c[i][j]=(c[i-1][j]+c[i-1][j-1])%p;
inc(1, i, n+1) Tar(i, 0);
// j=0;
// inc(1, i, 2*m+1) if(!vs[i]) ++j;
// ans=ans*dP(k, j>>1)%p;
// printf("%d\n", j);
printf("%lld\n", (ans+p)%p);
Re 0;
}
|
a.cc: In function 'int main()':
a.cc:90:5: error: 'scanf' was not declared in this scope
90 | scanf("%d%d%d", &n, &m, &k);
| ^~~~~
a.cc:105:5: error: 'printf' was not declared in this scope
105 | printf("%lld\n", (ans+p)%p);
| ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
3 | #include<algorithm>
+++ |+#include <cstdio>
4 | using namespace std;
|
s129955981
|
p03969
|
C++
|
int getfa(int x){ return x==fa[x]?x:fa[x]=getfa(fa[x]); }
void mrg(int x,int y){
x=getfa(x); y=getfa(y);
if (x==y) return;
sz[y]+=sz[x]; sum[y]+=sum[x]; fa[x]=y;
}
void dfs(int x,int p){
int i,y; vis[x]=1;
for (i=fst[x]; i; i=nxt[i]) if (i^p^1){
y=pnt[i];
if (!vis[y]){
dad[y]=x; d[y]=d[x]+1;
eg[y]=i>>1; bo[i>>1]=1; sz[i>>1]=0;
dfs(y,i);
}
}
}
int main(){
scanf("%d%d%d",&n,&m,&K);
int i,j,x,y;
for (i=0; i<=n+K; i++)
for (j=cbn[i][0]=1; j<=i; j++)
cbn[i][j]=(cbn[i-1][j]+cbn[i-1][j-1])%mod;
for (i=1; i<=m; i++){
scanf("%d%d",&x,&y);
add(x,y); add(y,x);
}
for (i=1; i<=m; i++){
fa[i]=i; sz[i]=sum[i]=1;
}
for (i=1; i<=n; i++) if (!vis[i]) dfs(i,0);
for (i=1; i<=m; i++) if (!bo[i]){
x=pnt[i<<1]; y=pnt[i<<1|1];
if (d[x]<d[y]) swap(x,y);
for (; x!=y; x=dad[x]) mrg(eg[x],i);
}
int ans=1;
for (i=1; i<=m; i++) if (getfa(i)==i){
if (sz[i]>1)
ans=(ll)ans*cbn[sum[i]+K-1][K-1]%mod;
else{
for (j=1,x=0; j<=sum[i]; j++)
x=(x+ksm(K,gcd(j,sum[i])))%mod;
ans=(ll)ans*x%mod*ksm(sum[i],mod-2)%mod;
}
}
printf("%d\n",ans);
return 0;
}
|
a.cc: In function 'int getfa(int)':
a.cc:2:29: error: 'fa' was not declared in this scope
2 | int getfa(int x){ return x==fa[x]?x:fa[x]=getfa(fa[x]); }
| ^~
a.cc: In function 'void mrg(int, int)':
a.cc:6:9: error: 'sz' was not declared in this scope
6 | sz[y]+=sz[x]; sum[y]+=sum[x]; fa[x]=y;
| ^~
a.cc:6:23: error: 'sum' was not declared in this scope
6 | sz[y]+=sz[x]; sum[y]+=sum[x]; fa[x]=y;
| ^~~
a.cc:6:39: error: 'fa' was not declared in this scope
6 | sz[y]+=sz[x]; sum[y]+=sum[x]; fa[x]=y;
| ^~
a.cc: In function 'void dfs(int, int)':
a.cc:9:18: error: 'vis' was not declared in this scope
9 | int i,y; vis[x]=1;
| ^~~
a.cc:10:16: error: 'fst' was not declared in this scope
10 | for (i=fst[x]; i; i=nxt[i]) if (i^p^1){
| ^~~
a.cc:10:29: error: 'nxt' was not declared in this scope
10 | for (i=fst[x]; i; i=nxt[i]) if (i^p^1){
| ^~~
a.cc:11:19: error: 'pnt' was not declared in this scope; did you mean 'int'?
11 | y=pnt[i];
| ^~~
| int
a.cc:13:25: error: 'dad' was not declared in this scope
13 | dad[y]=x; d[y]=d[x]+1;
| ^~~
a.cc:13:35: error: 'd' was not declared in this scope
13 | dad[y]=x; d[y]=d[x]+1;
| ^
a.cc:14:25: error: 'eg' was not declared in this scope
14 | eg[y]=i>>1; bo[i>>1]=1; sz[i>>1]=0;
| ^~
a.cc:14:37: error: 'bo' was not declared in this scope
14 | eg[y]=i>>1; bo[i>>1]=1; sz[i>>1]=0;
| ^~
a.cc:14:49: error: 'sz' was not declared in this scope
14 | eg[y]=i>>1; bo[i>>1]=1; sz[i>>1]=0;
| ^~
a.cc: In function 'int main()':
a.cc:20:25: error: 'n' was not declared in this scope
20 | scanf("%d%d%d",&n,&m,&K);
| ^
a.cc:20:28: error: 'm' was not declared in this scope
20 | scanf("%d%d%d",&n,&m,&K);
| ^
a.cc:20:31: error: 'K' was not declared in this scope
20 | scanf("%d%d%d",&n,&m,&K);
| ^
a.cc:20:9: error: 'scanf' was not declared in this scope
20 | scanf("%d%d%d",&n,&m,&K);
| ^~~~~
a.cc:23:24: error: 'cbn' was not declared in this scope
23 | for (j=cbn[i][0]=1; j<=i; j++)
| ^~~
a.cc:24:63: error: 'mod' was not declared in this scope
24 | cbn[i][j]=(cbn[i-1][j]+cbn[i-1][j-1])%mod;
| ^~~
a.cc:27:17: error: 'add' was not declared in this scope
27 | add(x,y); add(y,x);
| ^~~
a.cc:30:17: error: 'fa' was not declared in this scope
30 | fa[i]=i; sz[i]=sum[i]=1;
| ^~
a.cc:30:26: error: 'sz' was not declared in this scope
30 | fa[i]=i; sz[i]=sum[i]=1;
| ^~
a.cc:30:32: error: 'sum' was not declared in this scope
30 | fa[i]=i; sz[i]=sum[i]=1;
| ^~~
a.cc:32:35: error: 'vis' was not declared in this scope
32 | for (i=1; i<=n; i++) if (!vis[i]) dfs(i,0);
| ^~~
a.cc:33:35: error: 'bo' was not declared in this scope
33 | for (i=1; i<=m; i++) if (!bo[i]){
| ^~
a.cc:34:19: error: 'pnt' was not declared in this scope; did you mean 'int'?
34 | x=pnt[i<<1]; y=pnt[i<<1|1];
| ^~~
| int
a.cc:35:21: error: 'd' was not declared in this scope
35 | if (d[x]<d[y]) swap(x,y);
| ^
a.cc:35:32: error: 'swap' was not declared in this scope
35 | if (d[x]<d[y]) swap(x,y);
| ^~~~
a.cc:36:32: error: 'dad' was not declared in this scope
36 | for (; x!=y; x=dad[x]) mrg(eg[x],i);
| ^~~
a.cc:36:44: error: 'eg' was not declared in this scope
36 | for (; x!=y; x=dad[x]) mrg(eg[x],i);
| ^~
a.cc:40:21: error: 'sz' was not declared in this scope
40 | if (sz[i]>1)
| ^~
a.cc:41:30: error: 'll' was not declared in this scope
41 | ans=(ll)ans*cbn[sum[i]+K-1][K-1]%mod;
| ^~
a.cc:43:42: error: 'sum' was not declared in this scope
43 | for (j=1,x=0; j<=sum[i]; j++)
| ^~~
a.cc:44:44: error: 'gcd' was not declared in this scope
44 | x=(x+ksm(K,gcd(j,sum[i])))%mod;
| ^~~
a.cc:44:38: error: 'ksm' was not declared in this scope
44 | x=(x+ksm(K,gcd(j,sum[i])))%mod;
| ^~~
a.cc:44:60: error: 'mod' was not declared in this scope
44 | x=(x+ksm(K,gcd(j,sum[i])))%mod;
| ^~~
a.cc:45:30: error: 'll' was not declared in this scope
45 | ans=(ll)ans*x%mod*ksm(sum[i],mod-2)%mod;
| ^~
a.cc:48:9: error: 'printf' was not declared in this scope
48 | printf("%d\n",ans);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 |
|
s389852246
|
p03969
|
C++
|
#include<bits/stdc++.h>
#include<vector>
#define N 105
#define M 205
#define PAIR pair<int,int>
#define LL long long
using namespace std;
const int mo=1e9+7;
int head[N],len,next[N],num[N],ce,cd;
int n,m,k,f[N],C[M][M],pw[N],ans,dfn[N],low[N],clk,cut[N],st[N],top,vis[N],xyk;
int gcd(int x,int y){ return x ? gcd(y%x,x) : y;}
LL fpm(LL x,LL y){ LL s=1; while(y){ if(y&1) s=(s*x)%mo; y>>=1,x=(x*x)%mo;} return s;}
int cir(int n)
{
int i,ans=0;
for(i=1;i<=n;i++)
ans=(ans+pw[gcd(i,n)])%mo;
ans=(1LL*ans*fpm(n,mo-2))%mo;
return ans;
}
void calc(int e)
{
int x,y;
if(top==1) ans=(1LL*ans*k)%mo,top=0;
else{
cd=ce=0,++xyk;
while(top){
x=num[st[top]^0];
y=num[st[top]^1];
ce++;
if(vis[x]!=xyk) cd++,vis[x]=xyk;
if(vis[y]!=xyk) cd++,vis[y]=xyk;
if(st[top--]==e) break;
}
if(cd==ce) ans=(1LL*ans*cir(cd))%mo;
else ans=(1LL*ans*C[ce+k-1][k-1])%mo;
}
}
void tarjan(int t,int fa)
{
int i;
dfn[t]=low[t]=++clk,cut[t]=0;
for(i=head[t];i;i=next[i]){
if(num[i]==fa) continue;
if(!dfn[num[i]]){
st[++top]=i;
tarjan(num[i],t),low[t]=min(low[t],low[num[i]]);
if(low[num[i]]>=dfn[t]) cut[t]=1,calc(i);
}
else{
low[t]=min(low[t],dfn[num[i]]);
if(dfn[num[i]]<dfn[t]) st[++top]=i;
}
}
}
int main()
{
int i,j,x,y; ans=len=1;
scanf("%d %d %d",&n,&m,&k);
for(i=1;i<=m;i++){
scanf("%d %d",&x,&y);
num[++len]=y,next[len]=head[x],head[x]=len;
num[++len]=x,next[len]=head[y],head[y]=len;
}
C[0][0]=pw[0]=1;
for(i=1;i<M;i++){
C[i][0]=C[i][i]=1;
for(j=1;j<i;j++)
C[i][j]=(C[i-1][j-1]+C[i-1][j])%mo;
}
for(i=1;i<=m;i++) pw[i]=(1LL*pw[i-1]*k)%mo;
for(i=1;i<=n;i++)
if(!dfn[i])
tarjan(i,0),top=0;
cout<<ans;
return 0;
}
|
a.cc: In function 'void tarjan(int, int)':
a.cc:43:27: error: reference to 'next' is ambiguous
43 | for(i=head[t];i;i=next[i]){
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
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_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:9:17: note: 'int next [105]'
9 | int head[N],len,next[N],num[N],ce,cd;
| ^~~~
a.cc: In function 'int main()':
a.cc:62:30: error: reference to 'next' is ambiguous
62 | num[++len]=y,next[len]=head[x],head[x]=len;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:9:17: note: 'int next [105]'
9 | int head[N],len,next[N],num[N],ce,cd;
| ^~~~
a.cc:63:30: error: reference to 'next' is ambiguous
63 | num[++len]=x,next[len]=head[y],head[y]=len;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:9:17: note: 'int next [105]'
9 | int head[N],len,next[N],num[N],ce,cd;
| ^~~~
|
s804056929
|
p03969
|
C++
|
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
using namespace std;
const int N=1000;
const int mod=1e9+7;
int gi() {
int w=0;bool q=1;char c=getchar();
while ((c<'0'||c>'9') && c!='-') c=getchar();
if (c=='-') q=0,c=getchar();
while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
return q? w:-w;
}
int C[N][N],inv[N],qpow[N];
int head[N],next[N],to[N];
int ans=1,cnt,dfn[N],low[N],st[N],top,col,go[N],pre[N];
inline int gcd(int x,int y) { return y?gcd(y,x%y):x; }
inline int polya(int n) {
int ans=0;
for (int i=1;i<=n;i++) ans+=qpow[gcd(i,n)];
return 1LL*ans*inv[n]%mod;
}
inline void dfs(int k,int fa) {
dfn[k]=low[k]=++cnt;
st[++top]=k;
int s,i;bool flag;
for (i=head[k];i;i=next[i]) if (to[i]!=fa) {
if (!dfn[to[i]]) {
dfs(to[i],k),low[k]=min(low[k],low[to[i]]);
if (low[to[i]]>=dfn[k]) {
s=0;flag=false;
while (1) {
s+=pre[st[top]]+1,flag|=go[st[top]]>1;
if (st[top--]==to[i]) break;
}
ans=1LL*ans*(s==2?col:(flag?C[s+col-1][col-1]:polya(s)))%mod;
}
} else low[k]=min(low[k],dfn[to[i]]),pre[k]+=dfn[to[i]]<dfn[k];
go[k]+=low[to[i]]<=low[fa];
}
}
int main()
{
int n=gi(),m=gi(),i,tot=0,a,b,j;col=gi();
for (i=2,inv[1]=1;i<=m;i++) inv[i]=mod-1LL*inv[mod%i]*(mod/i)%mod;
for (i=C[0][0]=1;i<=m+col;i++)
for (j=C[i][0]=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
for (i=qpow[0]=1;i<=m;i++) qpow[i]=1LL*qpow[i-1]*col%mod;
while (m--) {
a=gi(),b=gi();
to[++tot]=b,next[tot]=head[a],head[a]=tot;
to[++tot]=a,next[tot]=head[b],head[b]=tot;
}
for (i=1;i<=n;i++) if (!dfn[i]) dfs(i,0);
printf("%d\n",ans);
return 0;
}
|
a.cc: In function 'void dfs(int, int)':
a.cc:34:28: error: reference to 'next' is ambiguous
34 | for (i=head[k];i;i=next[i]) if (to[i]!=fa) {
| ^~~~
In file included from /usr/include/c++/14/string:47,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:22:13: note: 'int next [1000]'
22 | int head[N],next[N],to[N];
| ^~~~
a.cc: In function 'int main()':
a.cc:58:29: error: reference to 'next' is ambiguous
58 | to[++tot]=b,next[tot]=head[a],head[a]=tot;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:22:13: note: 'int next [1000]'
22 | int head[N],next[N],to[N];
| ^~~~
a.cc:59:29: error: reference to 'next' is ambiguous
59 | to[++tot]=a,next[tot]=head[b],head[b]=tot;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:22:13: note: 'int next [1000]'
22 | int head[N],next[N],to[N];
| ^~~~
|
s550042467
|
p03969
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
int N,M,K;
vector<int> E[101];
int G[101];
ll mo=1000000007;
int NE[101];
class SCC_BI {
public:
static const int MV = 210000;
int NV,time;
vector<vector<int> > E;
vector<int> ord,llink,inin;
stack<int> roots,S;
vector<int> M; //point to group
vector<int> ART; // out
vector<vector<int> > SC; // out
vector<pair<int,int> > BR; // out
void init(int NV=MV) { this->NV=NV; E.clear(); E.resize(NV);}
void add_edge(int x,int y) { assert(NV); E[x].push_back(y); E[y].push_back(x); }
void dfs(int cur,int pre) {
int art=0,conn=0,i,se=0;
ord[cur]=llink[cur]=++time;
S.push(cur); inin[cur]=1; roots.push(cur);
FOR(i,E[cur].size()) {
int tar=E[cur][i];
if(ord[tar]==0) {
conn++; dfs(tar,cur);
llink[cur]=min(llink[cur],llink[tar]);
art += (pre!=-1 && ord[cur]<=llink[tar]);
if(ord[cur]<llink[tar]) BR.push_back(make_pair(min(cur,tar),max(cur,tar)));
}
else if(tar!=pre || se) {
llink[cur]=min(llink[cur],ord[tar]);
while(inin[tar]&&ord[roots.top()]>ord[tar]) roots.pop();
}
else se++; // double edge
}
if(cur==roots.top()) {
SC.push_back(vector<int>());
while(1) {
i=S.top(); S.pop(); inin[i]=0;
SC.back().push_back(i);
M[i]=SC.size()-1;
if(i==cur) break;
}
sort(SC.back().begin(),SC.back().end());
roots.pop();
}
if(art || (pre==-1&&conn>1)) ART.push_back(cur);
}
void scc() {
SC.clear(),BR.clear(),ART.clear(),M.resize(NV);
ord.clear(),llink.clear(),inin.clear(),time=0;
ord.resize(NV);llink.resize(NV);inin.resize(NV);
for(int i=0;i<NV;i++) if(!ord[i]) dfs(i,-1);
sort(BR.begin(),BR.end()); sort(ART.begin(),ART.end());
}
};
SCC_BI scc;
ll modpow(ll a, ll n = mo-2) {
ll r=1;
while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
return r;
}
ll combi(ll N_, ll C_) {
const int NUM_=400001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
if (fact[0]==0) {
inv[1]=fact[0]=factr[0]=1;
for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
}
if(C_<0 || C_>N_) return 0;
return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}
ll hcomb(int P_,int Q_) { return (P_==0&&Q_==0)?1:combi(P_+Q_-1,Q_);}
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N>>M>>K;
scc.init(N);
FOR(i,M) {
cin>>x>>y;
E[x-1].push_back(y-1);
E[y-1].push_back(x-1);
scc.add_edge(x-1,y-1);
}
scc.scc();
FOR(i,scc.SC.size()) FORR(r,scc.SC[i]) G[r]=i;
ll ret=1;
FOR(i,N) {
FORR(r,E[i]) if(i<r) {
if(G[i]!=G[r]) ret=ret*K%mo;
else NE[G[i]]++;
}
}
FOR(i,scc.SC.size()) if(scc.SC[i].size()>1) {
if(scc.SC[i].size()==NE[i]) {
// simple cycle
ll t=0;
for(j=1;j<=NE[i];j++) t+=pk[__gcd(j,NE[i])];
ret = ret * (t%mo)%mo*modpow(NE[i])%mo;
}
else {
// complex cycle
assert(0);
ret = ret*hcomb(K,NE[i])%mo;
}
}
cout<<ret<<endl;
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n';
FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
solve(); return 0;
}
|
a.cc: In function 'void solve()':
a.cc:124:50: error: 'pk' was not declared in this scope; did you mean 'k'?
124 | for(j=1;j<=NE[i];j++) t+=pk[__gcd(j,NE[i])];
| ^~
| k
|
s204593929
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string co;
cin >> co;
string CO = "CODEFESTIVAL2016";
int ans = 16;
rep(i, 16) {
if(Co.at(i) == co.at(i)) {
ans--;
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:10:8: error: 'Co' was not declared in this scope; did you mean 'CO'?
10 | if(Co.at(i) == co.at(i)) {
| ^~
| CO
|
s615797414
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i < (int)(b); ++i)
#define endl "\n"
typedef long long ll;
const double pi=3.14159265358979323846;
int ctoi(const char c) {
if ('0' <= c && c <= '9') return (c - '0');
return -1;
}
vector<int> input(int n) {
vector<int> vec(n);
for (int i = 0; i < n; i++) {
cin >> vec.at(i);
}
return vec;
}
void output(vector<int> vec) {
for (int i = 0; i < int(vec.size()); i++) {
cout << vec[i] << " ";
}
return;
}
vector<vector<int>> input(int n, int m) {
vector<vector<int>> table(n, vector<int>(m));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> table. at(i).at(j);
}
}
return table;
}
void output(vector<vector<int>> table) {
for (int i = 0; i < int(table.size()); i++) {
for (int j = 0; j < int(table.at(0).size()); j++) {
cout << table.at(i).at(j) << " ";
}
cout << endl;
}
}
long long perm(int n, int r) {
if (n < r) {
cout << "error" << endl;
return 0;
}
long long perm = 1;
for (int i = n; i > n - r; i--) {
perm *= i;
}
return perm;
}
long long comb(int n, int r) {
if (n < r) {
cout << "error" << endl;
return 0;
}
long long comb = perm(n,r);
for (int i = r; i > 0; i--) {
comb /= i;
}
return comb;
}
long long homo(int n, int r) {
return comb(n + r - 1, n - 1);
}
long long fact(int n) {
long long fact = 1;
for (int i = n; i > 0; i--) {
fact *= i;
}
return fact;
}
int gcd(int a, int b){
if (a % b == 0){
return(b);
}else{
return(gcd(b, a % b));
}
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
bool isprime(int n){
if (n < 2) return false;
else if (n == 2) return true;
else if (n % 2 == 0) return false;
for (int i = 3; i <= sqrt(n); i += 2){
if (n % i == 0){
return false;
}
}
return true;
}
vector<long long> divisors(long long N) {
vector<long long> res;
for (long long i = 1; i * i <= N; ++i) {
if (N % i == 0) {
res.push_back(i);
// 重複しないならば i の相方である N/i も push
if (N/i != i) res.push_back(N/i);
}
}
// 小さい順に並び替える
sort(res.begin(), res.end());
return res;
/*long long N;
cin >> N;
vector<long long> res = divisors(N);
for (int i = 0; i < res.size(); ++i) {
cout << res[i] << " ";
}
cout << endl;*/
}
vector<pair<long long, long long> > prime_factorize(long long N) {
vector<pair<long long, long long> > res;
for (long long a = 2; a * a <= N; ++a) {
if (N % a != 0) continue;
long long ex = 0;
while (N % a == 0) {
++ex;
N /= a;
}
res.push_back({a, ex});
}
if (N != 1) res.push_back({N, 1});
return res;
}
void sayYes(bool f) {
if (f) {
cout << "Yes" << endl;
}
else {
cout << "No" << endl;
}
}
void sayYES(bool f) {
if (f) {
cout << "YES" << endl;
}
else {
cout << "NO" << endl;
}
}
int main() {
string s;
cin >> s;
string t="CODEFESTIVAL2016"
int cnt=0;
rep(i,0,s.size()){
if(s[i]!=t[i]){
cnt++;
}
}
cout << cnt << endl;
}
|
a.cc: In function 'int main()':
a.cc:151:5: error: expected ',' or ';' before 'int'
151 | int cnt=0;
| ^~~
a.cc:154:7: error: 'cnt' was not declared in this scope; did you mean 'int'?
154 | cnt++;
| ^~~
| int
a.cc:157:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
157 | cout << cnt << endl;
| ^~~
| int
|
s547410651
|
p03970
|
C++
|
#include<iostream>
using namespace std;
int main(){
string s; cin >> s;
string x = "CODEFESTIVAL2016"
int cnt = 0;
for(int i = 0; i < 16; ++i)
cnt += s[i] == x[i];
cout << cnt << endl;
}
|
a.cc: In function 'int main()':
a.cc:6:3: error: expected ',' or ';' before 'int'
6 | int cnt = 0;
| ^~~
a.cc:8:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
8 | cnt += s[i] == x[i];
| ^~~
| int
a.cc:9:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
9 | cout << cnt << endl;
| ^~~
| int
|
s146140822
|
p03970
|
C++
|
#inclucde < bits/stdc++.h>
using namespace std;
int main() {
string s, t="CODEFESTIVAL2016";
cin >> s;
int ans=0;
for ( int i=0; i<t.size(); i++ ) {
if ( s[i]!=t[i] ) ans++;
}
cout << ans;
return 0;
}
|
a.cc:1:2: error: invalid preprocessing directive #inclucde; did you mean #include?
1 | #inclucde < bits/stdc++.h>
| ^~~~~~~~
| include
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
5 | string s, t="CODEFESTIVAL2016";
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | #inclucde < bits/stdc++.h>
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin >> s;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #inclucde < bits/stdc++.h>
a.cc:6:10: error: 's' was not declared in this scope
6 | cin >> s;
| ^
a.cc:8:20: error: 't' was not declared in this scope
8 | for ( int i=0; i<t.size(); i++ ) {
| ^
a.cc:11:3: error: 'cout' was not declared in this scope
11 | cout << ans;
| ^~~~
a.cc:11:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s775514246
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){string s;cin>>s;string S="CODEFESTIVAL2016";int c=0;for(int i=0,i<16;i++){if(s[i]!=S[i])c++;}cout<<c;}
|
a.cc: In function 'int main()':
a.cc:3:77: error: expected ';' before '<' token
3 | int main(){string s;cin>>s;string S="CODEFESTIVAL2016";int c=0;for(int i=0,i<16;i++){if(s[i]!=S[i])c++;}cout<<c;}
| ^
| ;
a.cc:3:77: error: expected primary-expression before '<' token
|
s732605139
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;int main(){string s;cin>>s;string S="CODEFESTIVAL2016";int c=0;for(int i=0,i<16;i++){if(s[i]!=S[i])c++;}cout<<c;}
|
a.cc: In function 'int main()':
a.cc:2:97: error: expected ';' before '<' token
2 | using namespace std;int main(){string s;cin>>s;string S="CODEFESTIVAL2016";int c=0;for(int i=0,i<16;i++){if(s[i]!=S[i])c++;}cout<<c;}
| ^
| ;
a.cc:2:97: error: expected primary-expression before '<' token
|
s216880479
|
p03970
|
C++
|
INT MAIN()bits/stdc++.h>
using namespace std;
int main(){
string s; cin >> s;
string t="CODEFESTIVAL2016";
int cnt=0;
for(int i=0;i<16;i++){
if(s[i]!=t[i])cnt++;
}
cout << cnt << endl;
}
|
a.cc:1:1: error: 'INT' does not name a type
1 | INT MAIN()bits/stdc++.h>
| ^~~
a.cc: In function 'int main()':
a.cc:5:2: error: 'string' was not declared in this scope
5 | string s; cin >> s;
| ^~~~~~
a.cc:5:12: error: 'cin' was not declared in this scope
5 | string s; cin >> s;
| ^~~
a.cc:5:19: error: 's' was not declared in this scope
5 | string s; cin >> s;
| ^
a.cc:6:8: error: expected ';' before 't'
6 | string t="CODEFESTIVAL2016";
| ^~
| ;
a.cc:9:12: error: 't' was not declared in this scope
9 | if(s[i]!=t[i])cnt++;
| ^
a.cc:11:3: error: 'cout' was not declared in this scope
11 | cout << cnt << endl;
| ^~~~
a.cc:11:18: error: 'endl' was not declared in this scope
11 | cout << cnt << endl;
| ^~~~
|
s466634146
|
p03970
|
C++
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// 最大公約数
ll GCD(ll a, ll b)
{
if (a < 0)
a = -a;
if (b < 0)
b = -b;
if (b == 0)
return a;
else
return GCD(b, a % b);
}
// 最小公倍数
ll LCM(ll a, ll b)
{
ll g = GCD(a, b);
return a / g * b;
}
int main()
{
strin in;
cin >> in;
int ret = 0;
if (in[0] != 'C')
{
ret++;
}
if (in[1] != 'O')
{
ret++;
}
if (in[2] != 'D')
{
ret++;
}
if (in[3] != 'E')
{
ret++;
}
if (in[4] != 'F')
{
ret++;
}
if (in[5] != 'E')
{
ret++;
}
if (in[6] != 'S')
{
ret++;
}
if (in[7] != 'T')
{
ret++;
}
if (in[8] != 'I')
{
ret++;
}
if (in[9] != 'V')
{
ret++;
}
if (in[10] != 'A')
{
ret++;
}
if (in[11] != 'L')
{
ret++;
}
if (in[12] != '2')
{
ret++;
}
if (in[13] != '0')
{
ret++;
}
if (in[14] != '1')
{
ret++;
}
if (in[15] != '6')
{
ret++;
}
cout << ret << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:48:5: error: 'strin' was not declared in this scope; did you mean 'stdin'?
48 | strin in;
| ^~~~~
| stdin
a.cc:49:12: error: 'in' was not declared in this scope; did you mean 'yn'?
49 | cin >> in;
| ^~
| yn
|
s225328393
|
p03970
|
C++
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// 最大公約数
ll GCD(ll a, ll b)
{
if (a < 0)
a = -a;
if (b < 0)
b = -b;
if (b == 0)
return a;
else
return GCD(b, a % b);
}
// 最小公倍数
ll LCM(ll a, ll b)
{
ll g = GCD(a, b);
return a / g * b;
}
int main()
{
string in;
cin >> in;
int ret = 0;
if (in[0] == "C")
{
ret++;
}
if (in[1] == "O")
{
ret++;
}
if (in[2] == "D")
{
ret++;
}
if (in[3] == "E")
{
ret++;
}
if (in[4] == "F")
{
ret++;
}
if (in[5] == "E")
{
ret++;
}
if (in[6] == "S")
{
ret++;
}
if (in[7] == "T")
{
ret++;
}
if (in[8] == "I")
{
ret++;
}
if (in[9] == "V")
{
ret++;
}
if (in[10] == "A")
{
ret++;
}
if (in[11] == "L")
{
ret++;
}
if (in[12] == "2")
{
ret++;
}
if (in[13] == "0")
{
ret++;
}
if (in[14] == "1")
{
ret++;
}
if (in[15] == "6")
{
ret++;
}
cout << ret << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:51:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
51 | if (in[0] == "C")
a.cc:55:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
55 | if (in[1] == "O")
a.cc:59:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
59 | if (in[2] == "D")
a.cc:63:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
63 | if (in[3] == "E")
a.cc:67:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
67 | if (in[4] == "F")
a.cc:71:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
71 | if (in[5] == "E")
a.cc:75:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
75 | if (in[6] == "S")
a.cc:79:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
79 | if (in[7] == "T")
a.cc:83:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
83 | if (in[8] == "I")
a.cc:87:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
87 | if (in[9] == "V")
a.cc:91:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
91 | if (in[10] == "A")
a.cc:95:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
95 | if (in[11] == "L")
a.cc:99:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
99 | if (in[12] == "2")
a.cc:103:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
103 | if (in[13] == "0")
a.cc:107:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
107 | if (in[14] == "1")
a.cc:111:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
111 | if (in[15] == "6")
|
s474452402
|
p03970
|
C++
|
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
string s; cin>>s;
int ans=0;
rep(i,16) if(s[i]!="C0DEFESTIVAL2O16") ans++;
printf("%d\n",ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:10:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | rep(i,16) if(s[i]!="C0DEFESTIVAL2O16") ans++;
|
s938820841
|
p03970
|
C++
|
#include<stdio.h>
using namespace std;
int main()
{
int n,A,B;
cin >> n >> A >> B;
char a[n];
cin>>a;
int c1=0,c2=0;
for(int i=0;i<n;i++)
{
if(a[i]=='c')
{
cout<<"No"<<endl;
continue;
}
if(a[i]=='a')
{
if(c1< A+B)
{
c1++;
cout<<"Yes"<<endl;
continue;
}}
if(a[i]=='b')
{
//c2++;
if(c1< A+B && c2<B)
{
c1++;c2++;
cout<<"Yes"<<endl;
continue;
}
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin >> n >> A >> B;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include<stdio.h>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:14:7: error: 'cout' was not declared in this scope
14 | cout<<"No"<<endl;
| ^~~~
a.cc:14:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:19: error: 'endl' was not declared in this scope
14 | cout<<"No"<<endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include<stdio.h>
+++ |+#include <ostream>
2 | using namespace std;
a.cc:22:9: error: 'cout' was not declared in this scope
22 | cout<<"Yes"<<endl;
| ^~~~
a.cc:22:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:22: error: 'endl' was not declared in this scope
22 | cout<<"Yes"<<endl;
| ^~~~
a.cc:22:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:31:9: error: 'cout' was not declared in this scope
31 | cout<<"Yes"<<endl;
| ^~~~
a.cc:31:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:22: error: 'endl' was not declared in this scope
31 | cout<<"Yes"<<endl;
| ^~~~
a.cc:31:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s560568849
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
int main(){
string s; cin >> s;
string t; = "CODEFESTIVAL2016";
int ans = 0;
for(int i = 0; i < 16; ++i){
if(s[i]!=t[i])++ans;
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:16:11: error: expected primary-expression before '=' token
16 | string t; = "CODEFESTIVAL2016";
| ^
|
s002157928
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string correct="CODEFESTIVAL2016"
string s;
cin >> s;
int ans=0;
for(int i=0;i<16;i++){
if(correct[i] != s[i])ans++;
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:6:1: error: expected ',' or ';' before 'string'
6 | string s;
| ^~~~~~
a.cc:7:8: error: 's' was not declared in this scope
7 | cin >> s;
| ^
|
s126508209
|
p03970
|
Java
|
import java.io.*;
import java.util.*;
import java.math.BigDecimal;
public class Main {
void submit() {
String missString = nextString;
char[] missChar= missString.toCharArray();
String seikaiString = "CODEFESTIVAL2016";
char[] seikaiChar = seikaiString.toCharArray();
int kaisu = 0;
for(int i=0; i<seikaiString.length(); i++){
if(missChar[i] != seikaiChar[i]) kaisu++;
}
out.println(kaisu);
}
void preCalc() {
}
void stress() {
}
void test() {
}
Main() throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
preCalc();
submit();
//stress();
//test();
out.close();
}
static final Random rng = new Random();
static int rand(int l, int r) {
return l + rng.nextInt(r - l + 1);
}
public static void main(String[] args) throws IOException {
new Main();
}
BufferedReader br;
PrintWriter out;
StringTokenizer st;
String nextToken() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return st.nextToken();
}
String nextString() {
try {
return br.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
int nextInt() {
return Integer.parseInt(nextToken());
}
long nextLong() {
return Long.parseLong(nextToken());
}
double nextDouble() {
return Double.parseDouble(nextToken());
}
}
|
Main.java:8: error: cannot find symbol
String missString = nextString;
^
symbol: variable nextString
location: class Main
1 error
|
s070295188
|
p03970
|
C++
|
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
int a, b, c, n;
string s;
int main()
{
cin>>s;int cnt=0;
t="CODEFESTIVAL2016";
rep(i,16)
if(s[i]==t[i])
cnt++;
cout<<16-cnt<<endl;
}
|
a.cc: In function 'int main()':
a.cc:21:3: error: 't' was not declared in this scope; did you mean 'tm'?
21 | t="CODEFESTIVAL2016";
| ^
| tm
|
s760022496
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
string S; cin>>S;
int N=S.size();
strint T="CODEFESTIVAL2016";
int ans=0;
rep(i,0,N){
if(S[i]!=T[i]) ans++;
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:22:3: error: 'strint' was not declared in this scope; did you mean 'strcat'?
22 | strint T="CODEFESTIVAL2016";
| ^~~~~~
| strcat
a.cc:25:14: error: 'T' was not declared in this scope
25 | if(S[i]!=T[i]) ans++;
| ^
|
s308748805
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
string S; cin>>S;
string T="CODEFESTIVAL2016";
int ans=0;
rep(i,0,N){
if(S[i]!=T[i]) ans++;
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:23:11: error: 'N' was not declared in this scope
23 | rep(i,0,N){
| ^
a.cc:3:47: note: in definition of macro 'rep'
3 | #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
| ^
|
s541533800
|
p03970
|
C++
|
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define int long long
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
if (a < b)
swap(a, b);
if (b == 0)
return a;
if (a % b == 0)
return b;
return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
return a * b / GCD(a, b);
}
double LOG(int a, int b) {
return log(b) / log(a);
}
inline bool BETWEEN(int x, int min,int max) {
if (min <= x && x <= max)
return true;
else
return false;
}
using namespace std;
#pragma endregion
signed main() {
string s;
string A = "CODEFESTIVAL2016";
int x=0;
cin >> s;
rep(i,16){
if (s[i] == A[i])
x++;
cout << x<<endl;
}
|
a.cc: In function 'int main()':
a.cc:52:2: error: expected '}' at end of input
52 | }
| ^
a.cc:43:15: note: to match this '{'
43 | signed main() {
| ^
|
s325992787
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
string c=CODEFESTIVAL2016;
int count=0;
for(int i=0;i<s.size();i++){
if(s.at(i)!=c.at(i)) count++;
}
cout << count;
}
|
a.cc: In function 'int main()':
a.cc:7:14: error: 'CODEFESTIVAL2016' was not declared in this scope
7 | string c=CODEFESTIVAL2016;
| ^~~~~~~~~~~~~~~~
|
s106126225
|
p03970
|
C++
|
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int main(){
string ss;
ss = "CODEFESTIVAL2016"
string s;
cin >> s;
int ans = 0;
rep(i,s.size()) if(s[i]!=ss[i]) ans++;
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:6:28: error: expected ';' before 'string'
6 | ss = "CODEFESTIVAL2016"
| ^
| ;
7 | string s;
| ~~~~~~
a.cc:8:12: error: 's' was not declared in this scope; did you mean 'ss'?
8 | cin >> s;
| ^
| ss
|
s908774498
|
p03970
|
C++
|
a
|
a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s903868090
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD 1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }
int main(int argc, char const *argv[]) {
string s;
string t="CODEFESTIVAL2016";
cin >> s;
int cnt=0;
rep(i,n){
if(s[i]!=t[i]) cnt++;
}
cout << cnt << endl;
return 0;
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:25:9: error: 'n' was not declared in this scope
25 | rep(i,n){
| ^
a.cc:3:34: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0; i<(n) ;i++)
| ^
|
s965147548
|
p03970
|
C++
|
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector>
#include <string.h>
#include <iomanip>
#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());//昇順ソート
#define usort(a) sort(a.rbegin(),a.rend());//降順ソート
using namespace::std;
int jo(ll int a, ll int b){//累乗
ll int num=1;
rep(i,0,b) num=num*a;
return num;
}
char tobig(char s){//char大文字化
return (s-0x20);
}
char tolow(char s){//char小文字化
return (s+0x20);
}
int ctoi(char a){//char->int
if('0'<=a&&a<='9') return (a-'0');
return -1;
}
int gcd(ll int a,ll int b) {//最大公約数
if(a<b) return gcd(b,a);
int c;
while ((c=a%b)) {
a=b;
b=c;
}
return b;
}
int lcm(ll int a,ll int b){//最小公倍数
return (a*b)/gcd(a,b);
}
int main(){
string A,B; cin>>A;
B="CODEFESTIVAL2016";
int count=0;
rep(i,0,A.length()){
if(A[i]!=B[i]) coutn++;
}
cout<<count;
}
// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));
//cout<<fixed<<setprecision(n); //小数点n桁まで表示
// vector<pair<int,int>> data(N); //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順
|
a.cc: In function 'int main()':
a.cc:56:20: error: 'coutn' was not declared in this scope; did you mean 'count'?
56 | if(A[i]!=B[i]) coutn++;
| ^~~~~
| count
|
s102025997
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for(int i=s;i<=e;++i)
#define REP(i,s,e) for(int i=s;i>=e;--i)
string s;
int main(){
int sum=0;
cin>>s;
if(s[0]=='C') sum++;
if(s[1]=='O') sum++;
if(s[2]=='D') sum++;
if(s[3]=='E') sum++;
if(s[4]=='F') sum++;
if(s[5]=='E') sum++;
if(s[6]=='S') sum++;
if(s[7]=='T') sum++;
if(s[8]=='I') sum++;
if(s[9]=='V') sum++;
if(s[10]=='A') sum++;
if(s[11]=='L') sum++;
if(s[12]=='2') sum++;
if(s[13]=='0') sum++;
if(s[14]=='1') sum++;
if(s[15]=='6') sum++;
cout<<16-sum<<endl;l;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:27:28: error: 'l' was not declared in this scope
27 | cout<<16-sum<<endl;l;
| ^
|
s815628508
|
p03970
|
C++
|
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end() //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI; // VI a(n);
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII; // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP; //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll; //ll とdoubleは違う
template <class T> // chmax(max, a);
bool chmax(T &a, const T &b)
{
if (a < b)
{
a = b;
return 1;
}
return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
if (b < a)
{
a = b;
return 1;
}
return 0;
}
template<typename T> // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
os << "{";
rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
os << "}";
return os;
}
template<typename T>
bool all_same(vector<T> v1,vector<T> v2)
{
sort(ALL(v1));
sort(ALL(v2),greater<T>());
return v1 == v2;
}
// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;
int main(){
ll a,b,d,x=0,y=0,z,n,m,k,lank=1,w,sum=0,sum2=0,ans=0;
string s,t;
bool ok=true;
cin >> s;
t = "CODEFESTIVAL2016"
rep(i,s.size()){
if(s[i]==t[i]){
ans++;
}
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:65:27: error: expected ';' before 'for'
65 | t = "CODEFESTIVAL2016"
| ^
| ;
a.cc:66:9: error: 'i' was not declared in this scope
66 | rep(i,s.size()){
| ^
a.cc:4:34: note: in definition of macro 'rep'
4 | #define rep(i, n) for(int i = 0; i < n; i++)
| ^
|
s014073665
|
p03970
|
C++
|
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s="CODEFESTIVAL2016a;
long long ans;
int main()
{
getline(cin,a);
for(register long long i=0;i<=15i++)
if(a[i]!=s[i])ans++;
cout<<ans<<endl;
return 0;
}
|
a.cc:4:10: warning: missing terminating " character
4 | string s="CODEFESTIVAL2016a;
| ^
a.cc:4:10: error: missing terminating " character
4 | string s="CODEFESTIVAL2016a;
| ^~~~~~~~~~~~~~~~~~~
a.cc:5:1: error: expected primary-expression before 'long'
5 | long long ans;
| ^~~~
a.cc: In function 'int main()':
a.cc:8:17: error: 'a' was not declared in this scope
8 | getline(cin,a);
| ^
a.cc:9:29: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
9 | for(register long long i=0;i<=15i++)
| ^
a.cc:9:39: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
9 | for(register long long i=0;i<=15i++)
| ~~~^~
a.cc:9:41: error: expected ';' before ')' token
9 | for(register long long i=0;i<=15i++)
| ^
| ;
a.cc:10:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
10 | if(a[i]!=s[i])ans++;
| ^~~
| abs
a.cc:11:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | cout<<ans<<endl;
| ^~~
| abs
|
s345278631
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,t="CODEFESTIVAL2016;
cin>>s;
int ans=0;
for(int i=0;i<s.length();i++)
if(s[i]!=t[i]) ans++;
cout<<ans;
}
|
a.cc:4:14: warning: missing terminating " character
4 | string s,t="CODEFESTIVAL2016;
| ^
a.cc:4:14: error: missing terminating " character
4 | string s,t="CODEFESTIVAL2016;
| ^~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:6: error: conversion from 'std::basic_istream<char>' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
5 | cin>>s;
| ~~~^~~
|
s082146396
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
//int w,h,tmp;
string s,t;
cin >> s;
int ans = 0;
t = "CODEFESTIVAL2016";
for(int i=0; i<s.size(); i++)
if(s.at(i)==t.at(i)) ans++;
`
cout << ans << endl;
}
|
a.cc:12:1: error: stray '`' in program
12 | `
| ^
|
s470665773
|
p03970
|
C++
|
#include<iostream>
using namespace std;
char a[16],b[16 ={'C', 'O', 'D', 'E', 'F', 'E', 'S', 'T', 'I', 'V', 'A', 'L', '2', '0', '1', '6'};
int ans;
int main()
{
cin>>a;
for(int i = 0; i < 16; i ++)
{
if(a[i]!=b[i])ans++;
}
cout <<ans<<endl;
return 0;
}
|
a.cc:3:14: error: lvalue required as left operand of assignment
3 | char a[16],b[16 ={'C', 'O', 'D', 'E', 'F', 'E', 'S', 'T', 'I', 'V', 'A', 'L', '2', '0', '1', '6'};
| ^~
a.cc:3:98: error: expected ']' before ';' token
3 | char a[16],b[16 ={'C', 'O', 'D', 'E', 'F', 'E', 'S', 'T', 'I', 'V', 'A', 'L', '2', '0', '1', '6'};
| ^
| ]
a.cc: In function 'int main()':
a.cc:10:18: error: 'b' was not declared in this scope
10 | if(a[i]!=b[i])ans++;
| ^
|
s915817652
|
p03970
|
C++
|
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
int main(void){
int i;
string s,t="CODEFESTIVAL2016";
cin >> s;
for (i=0;i<16;i++) if (s[i]!=t[i]) ans++;
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:10:38: error: 'ans' was not declared in this scope; did you mean 'abs'?
10 | for (i=0;i<16;i++) if (s[i]!=t[i]) ans++;
| ^~~
| abs
a.cc:11:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | cout << ans << endl;
| ^~~
| abs
|
s226092992
|
p03970
|
C++
|
#include<iostream>
using namespace std;
int main(void){
int a=0,b,c;
string s;
string t = "CODEFESTIVAL2016"
cin >> s;
for(int i = 0;i < s.size();i++){
if(s.at(i) != t.at(i)){
a++;
}
}
cout << a;
}
|
a.cc: In function 'int main()':
a.cc:7:2: error: expected ',' or ';' before 'cin'
7 | cin >> s;
| ^~~
|
s603111763
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string S; cin>>S;
string Z=="CODEFESTIVAL2016";
int A=0;
for(int i=0; i<16; i++){
if(S.at(i)==Z.at(i)) continue;
else A++;
}
cout<<A<<endl;
}
|
a.cc: In function 'int main()':
a.cc:6:11: error: expected initializer before '==' token
6 | string Z=="CODEFESTIVAL2016";
| ^~
a.cc:9:17: error: 'Z' was not declared in this scope
9 | if(S.at(i)==Z.at(i)) continue;
| ^
|
s063853820
|
p03970
|
C++
|
#include<Bits/stdc++.h>
using namespace std;
int ans;
string s,cmp="CODEFESTIVAL2016";
int main(){
cin>>s;
int l=s.size();
for(int i=0;i<l;i++)
if(s[i]!=cmp[i])ans++;
printf("%d\n",ans);
return 0;
}
|
a.cc:1:9: fatal error: Bits/stdc++.h: No such file or directory
1 | #include<Bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s228764997
|
p03970
|
C++
|
import java.util.Scanner;
class Main{
public static void main (String[] args){
Scanner scanner =new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
int d = scanner.nextInt();
if(a+b>c+d)
System.out.println("Left");
else if(a+b<c+d)
System.out.println("Right");
else
System.out.println("Balanced");
scanner.close();
}
}
|
a.cc:1:5: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:5: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:11: error: expected ':' before 'static'
3 | public static void main (String[] args){
| ^~~~~~~
| :
a.cc:3:30: error: 'String' has not been declared
3 | public static void main (String[] args){
| ^~~~~~
a.cc:3:39: error: expected ',' or '...' before 'args'
3 | public static void main (String[] args){
| ^~~~
a.cc:17:6: error: expected ';' after class definition
17 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:4:5: error: 'Scanner' was not declared in this scope
4 | Scanner scanner =new Scanner(System.in);
| ^~~~~~~
a.cc:5:13: error: 'scanner' was not declared in this scope
5 | int a = scanner.nextInt();
| ^~~~~~~
a.cc:10:5: error: 'System' was not declared in this scope
10 | System.out.println("Left");
| ^~~~~~
a.cc:12:5: error: 'System' was not declared in this scope
12 | System.out.println("Right");
| ^~~~~~
a.cc:14:5: error: 'System' was not declared in this scope
14 | System.out.println("Balanced");
| ^~~~~~
|
s204359886
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
string s="CODEFESTIVAL2016";
string cxk;
long long a;
int main(){
cin>>cxk;
if(cxk[0] != 'C') a++;
if(cxk[1] != 'O') a++;
if(cxk[2] != 'D') a++;
if(cxk[3] != 'E') a++;
if(cxk[4] != 'F') a++;
if(cxk[5] != 'E') a++;
if(cxk[6] != 'S') a++;
if(cxk[7] != 'T') a++;
if(cxk[8] != 'I') a++;
if(cxk[9] != 'V') a++;
if(cxk[10] != 'A') a++;
if(cxk[11] != 'L') a++;
if(cxk[12] != '2') a++;
if(cxk[13] != '0') a++;
if(cxk[14] != '1') a++;
if(cxk[15] != '6') ans++;
cout<<a<<endl;
}
|
a.cc: In function 'int main()':
a.cc:23:24: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | if(cxk[15] != '6') ans++;
| ^~~
| abs
|
s855665912
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
string S, T;
cin >> S;
T = "CODEFESTIVAL2016";
for(int i=0;i<16;i++){
if(S[i] != T[i]) ans++;
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:9:22: error: 'ans' was not declared in this scope; did you mean 'abs'?
9 | if(S[i] != T[i]) ans++;
| ^~~
| abs
a.cc:11:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | cout << ans << endl;
| ^~~
| abs
|
s703573906
|
p03970
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<char> data(16);
for (int i = 0; i < 16; i++) {
cin >> data.at(i);
}
string str = "CODEFESTIVAL2016"
int answer = 0 ;
for (int i = 0; i < 16; i++) {
if (data.at(i) != str.at(i) ) {
answer++;
}
}
cout << answer << endl;
}
|
a.cc: In function 'int main()':
a.cc:12:3: error: expected ',' or ';' before 'int'
12 | int answer = 0 ;
| ^~~
a.cc:17:7: error: 'answer' was not declared in this scope
17 | answer++;
| ^~~~~~
a.cc:22:11: error: 'answer' was not declared in this scope
22 | cout << answer << endl;
| ^~~~~~
|
s955293225
|
p03970
|
C++
|
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;
int main(){
string S,A="CODEFESTIVAL2016";
cin>>S;
int cnt=0;
for(int i=0; i<16; ++i){
if(S.at(i)!=A.at(i)) ans++;
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:23:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | if(S.at(i)!=A.at(i)) ans++;
| ^~~
| abs
a.cc:25:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
25 | cout<<ans<<endl;
| ^~~
| abs
|
s688054456
|
p03970
|
C++
|
#import<iostream>
char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
|
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<iostream>
| ^~~~~~
a.cc:2:37: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
| ^~~~
a.cc: In function 'int main()':
a.cc:2:91: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
2 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc: At global scope:
a.cc:2:103: error: expected constructor, destructor, or type conversion before '(' token
2 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
| ^
|
s987806809
|
p03970
|
C++
|
char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
|
a.cc:1:37: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
| ^~~~
a.cc: In function 'int main()':
a.cc:1:61: error: 'getchar' was not declared in this scope
1 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
| ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
a.cc:1:82: error: 'cout' is not a member of 'std'
1 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
| ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
a.cc:1:91: error: 'endl' was not declared in this scope
1 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
| ^~~~
a.cc: At global scope:
a.cc:1:103: error: expected constructor, destructor, or type conversion before '(' token
1 | char c[]="CODEFESTIVAL2016";int i,a;main(){for(;i<16;i++)a+=getchar()!=c[i];std::cout<<a<<endl;}printf("%d\n",a);
| ^
|
s518881001
|
p03970
|
C++
|
#import<iostream>
char c[]="CODEFESTIVAL2016";int i,ans;
main(){for(;i<17;i++)if(getchar()!=c[i])ans++;cout<<ans;}
|
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<iostream>
| ^~~~~~
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){for(;i<17;i++)if(getchar()!=c[i])ans++;cout<<ans;}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:47: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
3 | main(){for(;i<17;i++)if(getchar()!=c[i])ans++;cout<<ans;}
| ^~~~
| std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
|
s912407888
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
string a,b; int ans=0;
cin>>a; b="CODEFESTIVAL2016"
rep(i,16) if(a[i]!=b[i]) ans++;
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:6:31: error: expected ';' before 'for'
6 | cin>>a; b="CODEFESTIVAL2016"
| ^
| ;
a.cc:7:9: error: 'i' was not declared in this scope
7 | rep(i,16) if(a[i]!=b[i]) ans++;
| ^
a.cc:3:30: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;i++)
| ^
|
s163079029
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2="CODEFESTIVAL2016"
cin >> s1;
int x=0;
for(int i=0;i<16;i++){
if(s1[i]!=s2[i])x++;
}
cout<<x<<endl;
}
|
a.cc: In function 'int main()':
a.cc:5:3: error: expected ',' or ';' before 'cin'
5 | cin >> s1;
| ^~~
|
s640695074
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main() {
int a=0;
string s,s1="CODEFESTIVAL2016";
cin>>s;
for(int i=0;i<16;i++){
if(s[i]!=s1[i]){
ans++;
}
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
9 | ans++;
| ^~~
| abs
a.cc:12:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
12 | cout<<ans<<endl;
| ^~~
| abs
|
s196676616
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;cin>>s;
vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
int n=0;
for(int i=0;i<16;i++){
if(s.at(i)!=a.at(i))n++;
}
cout<<n<<endl;
}
|
a.cc: In function 'int main()':
a.cc:5:18: error: 'C' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:20: error: 'O' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:22: error: 'D' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:24: error: 'E' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:26: error: 'F' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:30: error: 'S' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:32: error: 'T' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:34: error: 'I' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:36: error: 'V' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:38: error: 'A' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:40: error: 'L' was not declared in this scope
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
a.cc:5:49: error: no matching function for call to 'std::vector<char>::vector(<brace-enclosed initializer list>)'
5 | vector<char> a{C,O,D,E,F,E,S,T,I,V,A,L,2,0,1,6};
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = char; _Alloc = std::allocator<char>]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 3 arguments, 16 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate expects 2 arguments, 16 provided
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>; std::__type_identity_t<_Alloc> = std::allocator<char>]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 16 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 16 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 16 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>; std::__type_identity_t<_Alloc> = std::allocator<char>]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 16 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = char; _Alloc = std::allocator<char>]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 16 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 16 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; size_type = long unsigned int; value_type = char; allocator_type = std::allocator<char>]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 3 arguments, 16 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; size_type = long unsigned int; allocator_type = std::allocator<char>]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate expects 2 arguments, 16 provided
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 16 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = char; _Alloc = std::allocator<char>]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 16 provided
|
s850299457
|
p03970
|
C++
|
object Main{
def main(args: Array[String]): Unit={
val str = readLine()
val code = "CODEFESTIVAL2016"
var cnt = 0
for(i<-0 to 15; if str(i) != code(i)) yield cnt+=1
println(cnt)
}
}
|
a.cc:1:1: error: 'object' does not name a type
1 | object Main{
| ^~~~~~
|
s834508404
|
p03970
|
C++
|
#include<bits/stdc++.h>
using namespace std;
string a,b="CODEFESTIVAL2016";
int main()
{
double ans;
c=16;
getline(cin,a);
for(int i=0;i<=15;i++)
{
if(a[i]==b[i]) ans--;
}
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:9: error: 'c' was not declared in this scope
7 | c=16;
| ^
|
s985287068
|
p03970
|
C++
|
include<bits/stdc++.h>//万能文件头
using namespace std;
string s="CODEFESTIVAL2016";//好像也没什么用
string a;
long long ans;
int main(){
cin>>a;//输入字符串
if(a[0] != 'C') ans++;//开始无脑判断
if(a[1] != 'O') ans++;//要是有一个不一样
if(a[2] != 'D') ans++;//就马上加上去
if(a[3] != 'E') ans++;
if(a[4] != 'F') ans++;
if(a[5] != 'E') ans++;
if(a[6] != 'S') ans++;
if(a[7] != 'T') ans++;
if(a[8] != 'I') ans++;
if(a[9] != 'V') ans++;
if(a[10] != 'A') ans++;
if(a[11] != 'L') ans++;
if(a[12] != '2') ans++;
if(a[13] != '0') ans++;
if(a[14] != '1') ans++;
if(a[15] != '6') ans++;
cout<<ans<<endl;//加完了,输出
}
|
a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>//万能文件头
| ^~~~~~~
a.cc:3:1: error: 'string' does not name a type
3 | string s="CODEFESTIVAL2016";//好像也没什么用
| ^~~~~~
a.cc:4:1: error: 'string' does not name a type
4 | string a;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
7 | cin>>a;//输入字符串
| ^~~
a.cc:7:10: error: 'a' was not declared in this scope
7 | cin>>a;//输入字符串
| ^
a.cc:24:5: error: 'cout' was not declared in this scope
24 | cout<<ans<<endl;//加完了,输出
| ^~~~
a.cc:24:16: error: 'endl' was not declared in this scope
24 | cout<<ans<<endl;//加完了,输出
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.