Submission #16052951
Source Code Expand
#include<iostream>
#include<algorithm>
#include <iostream>
#include <algorithm>
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a) for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
ll ret = 1;
for(; e > 0; e >>= 1)
{
if(e & 1) ret = (ret * p) % M;
p = (p * p) % M;
}
return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
if(b == 0)return a;
return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
ll ret = 1;
for(; e > 0; e >>= 1)
{
if(e & 1) ret = (ret * p);
p = (p * p);
}
return (T)ret;
}
template <class T>bool ISLEFT(T a, T b, T c)
{
if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1; //Uporer dike //A,b,c, x okkher ordera sorted
else return 0;
}
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
int main(){
int n;
I(n);
int ar[n+2];
for(int i=1;i<=n;i++)I(ar[i]);
sort(ar +1, ar+ n+ 1);
int res =0;
for(int i=1;i<=n;i++){
for(int j = i+1;j<=n;j++){
if(ar[i] == ar[j])continue;
for(int k = j+1;k<=n;k++){
if(ar[k] == ar[j] || ar[k] == ar[1])continue;
if(ar[i] + ar[j] > ar[k])res++;
}
}
}
cout<<res<<Endl;
return 0;
}
Submission Info
| Submission Time |
|
| Task |
B - Making Triangle |
| User |
mahbubcseju |
| Language |
C++ (GCC 9.2.1) |
| Score |
200 |
| Code Size |
2730 Byte |
| Status |
AC |
| Exec Time |
7 ms |
| Memory |
3688 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:15:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
15 | #define I(a) scanf("%d",&a)
| ~~~~~^~~~~~~~~
./Main.cpp:94:5: note: in expansion of macro ‘I’
94 | I(n);
| ^
./Main.cpp:15:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
15 | #define I(a) scanf("%d",&a)
| ~~~~~^~~~~~~~~
./Main.cpp:96:26: note: in expansion of macro ‘I’
96 | for(int i=1;i<=n;i++)I(ar[i]);
| ^
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
200 / 200 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
s1.txt, s2.txt, s3.txt, s4.txt |
| All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, s1.txt, s2.txt, s3.txt, s4.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 01.txt |
AC |
7 ms |
3536 KiB |
| 02.txt |
AC |
2 ms |
3688 KiB |
| 03.txt |
AC |
5 ms |
3500 KiB |
| 04.txt |
AC |
4 ms |
3656 KiB |
| 05.txt |
AC |
3 ms |
3504 KiB |
| 06.txt |
AC |
2 ms |
3520 KiB |
| 07.txt |
AC |
2 ms |
3640 KiB |
| 08.txt |
AC |
3 ms |
3516 KiB |
| 09.txt |
AC |
2 ms |
3656 KiB |
| 10.txt |
AC |
1 ms |
3648 KiB |
| 11.txt |
AC |
2 ms |
3660 KiB |
| 12.txt |
AC |
5 ms |
3540 KiB |
| 13.txt |
AC |
3 ms |
3652 KiB |
| 14.txt |
AC |
2 ms |
3656 KiB |
| 15.txt |
AC |
2 ms |
3540 KiB |
| 16.txt |
AC |
2 ms |
3636 KiB |
| 17.txt |
AC |
2 ms |
3660 KiB |
| 18.txt |
AC |
2 ms |
3500 KiB |
| 19.txt |
AC |
4 ms |
3512 KiB |
| s1.txt |
AC |
2 ms |
3652 KiB |
| s2.txt |
AC |
3 ms |
3512 KiB |
| s3.txt |
AC |
3 ms |
3652 KiB |
| s4.txt |
AC |
2 ms |
3616 KiB |