/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 7ms 8.066 MiB
#2 Accepted 7ms 8.102 MiB
#3 Accepted 7ms 8.254 MiB
#4 Accepted 7ms 8.27 MiB
#5 Accepted 7ms 8.062 MiB
#6 Accepted 7ms 8.309 MiB
#7 Accepted 7ms 8.27 MiB
#8 Accepted 10ms 8.27 MiB
#9 Accepted 11ms 8.211 MiB
#10 Accepted 11ms 8.27 MiB
#11 Accepted 11ms 8.27 MiB
#12 Accepted 12ms 8.27 MiB
#13 Accepted 13ms 8.074 MiB
#14 Accepted 13ms 8.113 MiB
#15 Accepted 13ms 8.254 MiB
#16 Accepted 13ms 8.305 MiB
#17 Accepted 13ms 8.105 MiB
#18 Accepted 13ms 8.273 MiB
#19 Accepted 13ms 8.312 MiB
#20 Accepted 13ms 8.27 MiB
#21 Accepted 13ms 8.062 MiB
#22 Accepted 10ms 8.27 MiB
#23 Accepted 23ms 8.062 MiB
#24 Accepted 22ms 8.316 MiB
#25 Accepted 12ms 8.273 MiB
#26 Accepted 12ms 8.207 MiB
#27 Accepted 12ms 8.27 MiB
#28 Accepted 19ms 8.066 MiB
#29 Accepted 19ms 8.27 MiB
#30 Accepted 18ms 8.27 MiB

Code

#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;
 
typedef tree<long long, null_type, less_equal<long long>,
             rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
 
#define endl '\n'
#define ll long long
#define int long long
#define ld long double
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll> pll;
#define pb push_back
#define eb emplace_back
//#define mp make_pair
#define srt(v) sort(v.begin(),v.end())
#define all(v) (v).begin(), (v).end()
#define yes() cout<<"YES"<<endl
#define no() cout<<"NO"<<endl
const ll mod = 1e9 + 7;
const ll N = 1e6;
long double EPS = 1e-7;
 
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}
 
void myerase(ordered_set &t, int v){
    int rank = t.order_of_key(v);//Number of elements that are less than v in t
    ordered_set::iterator it = t.find_by_order(rank); //Iterator that points to the (rank+1)th element in t
    t.erase(it);
}
 
// vi factorial(N + 1);
// factorial[0] = 1;
// for (int i = 1; i <= N; i++) {
//     factorial[i] = factorial[i - 1] * i % mod;
// }
 
int josephus(int n, int k) {
    return n > 1 ? (josephus(n-1, k) + k - 1) % n + 1 : 1;
}
 
long long power(long long x, int y, int p)
{
    long long res = 1; // Initialize result
 
    x = x % p; // Update x if it is more than or
    // equal to p
 
    while (y > 0) 
    {
     
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res * x) % p;
 
        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
 
// Returns n^(-1) mod p
long long modInverse(long long n,  int p)
{
    return power(n, p - 2, p);
}
 
// Returns nCr % p using Fermat's little
// theorem.
long long nCrModPFermat(long long n,int r, int p,vi& fac)
{
    // If n<r, then nCr should return 0
    if (n < r)
        return 0;
    // Base case
    if (r == 0)
        return 1;
 
    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
 
    return (fac[n] * modInverse(fac[r], p) % p
            * modInverse(fac[n - r], p) % p)
           % p;
}
 
ll gcd(ll a, ll b){if(b==0) return a; return gcd(b,a%b);}
vector<bool> nums(N+1);
// vector<int> smallest_factor(N+1);
vector<int> primes;
void sieve(){
    nums[0] = true;
    nums[1] = true;
    for(int i = 2; i <= N; i++){
        if(nums[i] == false){
            primes.push_back(i);
            // smallest_factor[i] = i;
            for(int j = i*i; j <= N; j+=i){
                nums[j] = true;
                // smallest_factor[j] = i;
            }
        }
    }
}
 
vi spf(N+1,1);
void smallestPrimeFactor()
{
    // stores smallest prime factor for every number
 
    spf[0] = 0;
    for (int i = 2; i <= N; i++) {
        if (spf[i] == 1) { // if the number is prime ,mark
                           // all its multiples who havent
                           // gotten their spf yet
            for (int j = i; j <= N; j += i) {
                if (spf[j]== 1) // if its smallest prime factor is
                          // 1 means its spf hasnt been
                          // found yet so change it to i
                    spf[j] = i;
            }
        }
    }
}
 
bool checkPrime(int n){ 
 
    // Initialize a counter variable to
    // count the number of factors.
    int cnt = 0;
 
    // Loop through numbers from 1
    // to the square root of n.
    for(int i = 1; i <= sqrt(n); i++){ 
 
        // If n is divisible by i
        // without any remainder.
        if(n % i == 0){ 
 
            // Increment the counter.
            cnt = cnt + 1;
 
            // If n is not a perfect square,
            // count its reciprocal factor.
            if(n / i != i){
                cnt = cnt + 1;
            }
        }
    }
 
    // If the number of
    // factors is exactly 2.
    if(cnt == 2){
         // Return true, indicating
         // that the number is prime.
        return true;
    }
    // If the number of
    // factors is not 2.
    else{ 
        // Return false, indicating
        // that the number is not prime.
        return false; 
    }
}
 
int mex(vi arr)
{
    int m=0;
    srt(arr);
    for(int i=0;i<arr.size();i++)
    {
        if(arr[i]==m) m++;
    }
    return m;
}
 
/*
2D Prefix Sum 
Here arr is the matrix whose prefix sum we want to calculate
prefix is the matrix which stores the prefix sums
val is the sum of all entries in arr from row x1, column y1 to row x2,column y2
 
vvi generatePrefixArray(int n,int m,vvi& arr)
{
    vector<vector<int>>prefix(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            prefix[i][j]=prefix[i-1][j]+prefix[i][j-1]-prefix[i-1][j-1]+arr[i-1][j-1];
        }
    }
    return prefix;
}
 
int calculate2DPrefixSum(vvi& prefix,int x1,int x2,int y1,int y2)
{
 
    int val;
    val=abs(prefix[x2][y2]+prefix[x1-1][y1-1]-prefix[x1-1][y2]-prefix[x2][y1-1]);
    return val; 
}

 
*/

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int a,b,c;
    cin>>a>>b>>c;
    vi triangle={a,b,c};
    srt(triangle);
    a=triangle[0];
    b=triangle[1];
    c=triangle[2];
    if(c>a+b)
    {
        cout<<"Not a triangle\n";
    }
    else
    {
        if(a==b && b==c) cout<<"Equilateral\n";
        else if(a!=b && b!=c) cout<<"Scalene\n";
        else cout<<"Isosceles\n";
    }
}

Information

Submit By
Type
Submission
Problem
P1108 Triangle Triangle Triangle!!!
Contest
Brain Booster #8
Language
C++17 (G++ 13.2.0)
Submit At
2025-02-17 14:33:29
Judged At
2025-02-17 14:33:29
Judged By
Score
100
Total Time
23ms
Peak Memory
8.316 MiB