Submission #70411889
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#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 FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------
int N;
int C[202020];
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N;
FOR(i,N) {
cin>>x;
C[x]++;
}
ll ret=0;
for(i=1;i<=N;i++) {
ret+=1LL*C[i]*(C[i]-1)/2*(N-C[i]);
}
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);
cout.tie(0); solve(); return 0;
}
Submission Info
| Submission Time |
|
| Task |
C - Odd One Subsequence |
| User |
kmjp |
| Language |
C++ 20 (gcc 12.2) |
| Score |
300 |
| Code Size |
1051 Byte |
| Status |
AC |
| Exec Time |
12 ms |
| Memory |
4256 KiB |
Compile Error
Main.cpp: In function ‘void solve()’:
Main.cpp:20:15: warning: unused variable ‘j’ [-Wunused-variable]
20 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp:20:17: warning: unused variable ‘k’ [-Wunused-variable]
20 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp:20:19: warning: unused variable ‘l’ [-Wunused-variable]
20 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp:20:21: warning: unused variable ‘r’ [-Wunused-variable]
20 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp:20:25: warning: unused variable ‘y’ [-Wunused-variable]
20 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp: In function ‘int main(int, char**)’:
Main.cpp:6:19: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
6 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^~~
Main.cpp:39:9: note: in expansion of macro ‘FOR’
39 | FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
| ^~~
Main.cpp:6:19: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
6 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^~~
Main.cpp:39:45: note: in expansion of macro ‘FOR’
39 | FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
| ^~~
Main.cpp:6:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
6 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^
Main.cpp:39:45: note: in expansion of macro ‘FOR’
39 | FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
| ^~~
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
300 / 300 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
example_00.txt, example_01.txt |
| All |
example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt |
| Case Name |
Status |
Exec Time |
Memory |
| example_00.txt |
AC |
1 ms |
3452 KiB |
| example_01.txt |
AC |
1 ms |
3532 KiB |
| hand_00.txt |
AC |
12 ms |
4204 KiB |
| hand_01.txt |
AC |
10 ms |
3416 KiB |
| hand_02.txt |
AC |
8 ms |
3324 KiB |
| hand_03.txt |
AC |
1 ms |
3468 KiB |
| hand_04.txt |
AC |
1 ms |
3380 KiB |
| hand_05.txt |
AC |
11 ms |
3484 KiB |
| random_00.txt |
AC |
11 ms |
4256 KiB |
| random_01.txt |
AC |
11 ms |
4248 KiB |
| random_02.txt |
AC |
11 ms |
4252 KiB |
| random_03.txt |
AC |
12 ms |
4104 KiB |
| random_04.txt |
AC |
12 ms |
4252 KiB |
| random_05.txt |
AC |
11 ms |
3556 KiB |
| random_06.txt |
AC |
10 ms |
3408 KiB |
| random_07.txt |
AC |
11 ms |
3492 KiB |
| random_08.txt |
AC |
10 ms |
3532 KiB |
| random_09.txt |
AC |
11 ms |
3552 KiB |
| random_10.txt |
AC |
9 ms |
3472 KiB |
| random_11.txt |
AC |
9 ms |
3420 KiB |
| random_12.txt |
AC |
9 ms |
3360 KiB |
| random_13.txt |
AC |
9 ms |
3420 KiB |
| random_14.txt |
AC |
8 ms |
3532 KiB |
| random_15.txt |
AC |
7 ms |
3444 KiB |
| random_16.txt |
AC |
7 ms |
3536 KiB |
| random_17.txt |
AC |
7 ms |
3608 KiB |
| random_18.txt |
AC |
7 ms |
3476 KiB |
| random_19.txt |
AC |
7 ms |
3420 KiB |