chacoderのブログ

競技プログラミングそのほか

Codeforces 1490C

Problem - 1490C - Codeforces

Codeforcesの問題で手元環境での出力と提出結果が違ってどうしてもWAがとれないので後日の検討のためアップしておきます。


提出コード

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cube[10010];

int main(){
  map<long,long>mp;
  for(long long i=1;i<=10000;i++){
    cube[i]=i*i*i;
    mp[cube[i]]++;
  }
  int t;
  cin>>t;
  ll temp=0;
  string ans;
  for(int i=0;i<t;i++){
    cin>>temp;
    ans="NO";
    for(int k=1;k<=10000;k++){
      if(cube[k]>temp) break;
      if(mp[temp-cube[k]]>0){
        ans="YES";
        break;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}