제출 #589401

#제출 시각아이디문제언어결과실행 시간메모리
589401ignusCards (LMIO19_korteles)C++14
0 / 100
4 ms4052 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int a[4][676]; int b[4][676]; int c[456976]; long long fin = 0; for(int i = 0; i < 676; i++){ for(int j = 0; j < 4; j++)a[j][i]=0; for(int j = 0; j < 4; j++)b[j][i]=0; } for(int i = 0; i < 4556976; i++){ c[i]=0; } for(int i = 0; i < n; i++){ char t1, t2, t3, t4; cin >> t1 >> t2 >> t3 >> t4; long long r1=0, r4=0, r2c=0, r2o=0; if(t1==t4&&t2==t3){ r4+=c[26*(26*(26*(t3-'A')+t4-'A')+t1-'A')+t2-'A']; } if(t1==t4){ r2c+=b[1][26*(t1-'A')+t2-'A']-r4; r2c+=b[0][26*(t1-'A')+t3-'A']-r4; } if(t2==t3){ r2c+=b[2][26*(t2-'A')+t4-'A']-r4; r2c+=b[3][26*(t2-'A')+t1-'A']-r4; } r2o+=c[26*(26*(26*(t2-'A')+t1-'A')+t4-'A')+t3-'A']-r4; r2o+=c[26*(26*(26*(t3-'A')+t4-'A')+t1-'A')+t2-'A']-r4; r1=a[0][26*(t3-'A')+t4-'A']+a[1][26*(t1-'A')+t2-'A']+a[2][26*(t2-'A')+t4-'A']+a[3][26*(t1-'A')+t3-'A']-r4*4-r2c*2-r2o*2; fin+=r1+r2o+r2c+r4; if(t1==t4){ b[0][26*(t1-'A')+t2-'A']++; b[1][26*(t1-'A')+t3-'A']++; } if(t2==t3){ b[2][26*(t2-'A')+t1-'A']++; b[3][26*(t2-'A')+t4-'A']++; } if(t1==t4&&t2==t3){ c[26*(26*(26*(t1-'A')+t2-'A')+t3-'A')+t4-'A']++; } a[0][26*(t1-'A')+t2-'A']++; a[1][26*(t3-'A')+t4-'A']++; a[2][26*(t1-'A')+t3-'A']++; a[3][26*(t2-'A')+t4-'A']++; } cout << fin; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

korteles.cpp: In function 'int main()':
korteles.cpp:16:7: warning: iteration 456976 invokes undefined behavior [-Waggressive-loop-optimizations]
   16 |   c[i]=0;
      |   ~~~~^~
korteles.cpp:15:19: note: within this loop
   15 |  for(int i = 0; i < 4556976; i++){
      |                 ~~^~~~~~~~~
korteles.cpp:16:7: warning: 'void* __builtin_memset(void*, int, long unsigned int)' forming offset [1827904, 18227903] is out of the bounds [0, 1827904] of object 'c' with type 'int [456976]' [-Warray-bounds]
   16 |   c[i]=0;
      |   ~~~~^~
korteles.cpp:9:6: note: 'c' declared here
    9 |  int c[456976];
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...